当前位置: 首页>>代码示例>>PHP>>正文


PHP eZLocale::localeInformation方法代码示例

本文整理汇总了PHP中eZLocale::localeInformation方法的典型用法代码示例。如果您正苦于以下问题:PHP eZLocale::localeInformation方法的具体用法?PHP eZLocale::localeInformation怎么用?PHP eZLocale::localeInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZLocale的用法示例。


在下文中一共展示了eZLocale::localeInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: eZLocale

 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';
 }
开发者ID:legende91,项目名称:ez,代码行数:80,代码来源:ezlocale.php


注:本文中的eZLocale::localeInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。