function eZLocale($localeString) { $this->IsValid = false; $this->TimePHPArray = array('g', 'G', 'h', 'H', 'i', 's', 'U', 'I', 'L', 't'); $this->DatePHPArray = array('d', 'j', 'm', 'n', 'O', 'S', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z', 'I', 'L', 't'); $this->DateTimePHPArray = array('d', 'j', 'm', 'n', 'O', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z', 'g', 'G', 'h', 'H', 'i', 's', 'S', 'U', 'I', 'L', 't', 'a', 'c', 'r'); $this->TimeArray = preg_replace('/.+/', '%$0', $this->TimePHPArray); $this->DateArray = preg_replace('/.+/', '%$0', $this->DatePHPArray); $this->DateTimeArray = preg_replace('/.+/', '%$0', $this->DateTimePHPArray); $this->TimeSlashInputArray = preg_replace('/.+/', '/(?<!%)$0/', $this->TimePHPArray); $this->DateSlashInputArray = preg_replace('/.+/', '/(?<!%)$0/', $this->DatePHPArray); $this->DateTimeSlashInputArray = preg_replace('/.+/', '/(?<!%)$0/', $this->DateTimePHPArray); $this->TimeSlashOutputArray = preg_replace('/.+/', '\\\\$0', $this->TimePHPArray); $this->DateSlashOutputArray = preg_replace('/.+/', '\\\\$0', $this->DatePHPArray); $this->DateTimeSlashOutputArray = preg_replace('/.+/', '\\\\$0', $this->DateTimePHPArray); $this->HTTPLocaleCode = ''; $this->functionMap = array('time' => 'formatTime', 'shorttime' => 'formatShortTime', 'date' => 'formatDate', 'shortdate' => 'formatShortDate', 'datetime' => 'formatDateTime', 'shortdatetime' => 'formatShortDateTime', 'currency' => 'formatCurrencyWithSymbol', 'clean_currency' => 'formatCleanCurrency', 'number' => 'formatNumber'); $this->DayNames = array(0 => 'sun', 1 => 'mon', 2 => 'tue', 3 => 'wed', 4 => 'thu', 5 => 'fri', 6 => 'sat'); $this->MonthNames = array(1 => 'jan', 2 => 'feb', 3 => 'mar', 4 => 'apr', 5 => 'may', 6 => 'jun', 7 => 'jul', 8 => 'aug', 9 => 'sep', 10 => 'oct', 11 => 'nov', 12 => 'dec'); $this->WeekDays = array(0, 1, 2, 3, 4, 5, 6); $this->Months = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); $locale = eZLocale::localeInformation($localeString); $this->CountryCode = $locale['country']; $this->CountryVariation = $locale['country-variation']; $this->LanguageCode = $locale['language']; $this->LocaleCode = $locale['locale']; $this->TranslationCode = $locale['locale']; $this->Charset = $locale['charset']; $this->OverrideCharset = $locale['charset']; $this->LocaleINI = array('default' => null, 'variation' => null); $this->CountryINI = array('default' => null, 'variation' => null); $this->LanguageINI = array('default' => null, 'variation' => null); // Figure out if we use one locale file or separate country/language file. $localeINI = $this->localeFile(); $countryINI = $localeINI; $languageINI = $localeINI; if ($localeINI === null) { $countryINI = $this->countryFile(); $languageINI = $this->languageFile(); } $this->reset(); $this->IsValid = true; // Load country information if ($countryINI !== null) { $this->initCountry($countryINI); } else { $this->IsValid = false; eZDebug::writeError('Could not load country settings for ' . $this->CountryCode, 'eZLocale'); } // Load language information if ($languageINI !== null) { $this->initLanguage($languageINI); } else { $this->IsValid = false; eZDebug::writeError('Could not load language settings for ' . $this->LanguageCode, 'eZLocale'); } // Load variation if any if ($this->countryVariation()) { $localeVariationINI = $this->localeFile(true); $countryVariationINI = $localeVariationINI; $languageVariationINI = $localeVariationINI; if ($localeVariationINI === null) { $countryVariationINI = $this->countryFile(true); $languageVariationINI = $this->languageFile(true); } // Load country information if ($countryVariationINI !== null) { $this->initCountry($countryVariationINI); } // Load language information if ($languageVariationINI !== null) { $this->initLanguage($languageVariationINI); } } if ($this->MondayFirst) { $this->WeekDays[] = array_shift($this->WeekDays); } $this->AM = 'am'; $this->PM = 'pm'; }