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


PHP TTi18n::master_locale方法代码示例

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


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

示例1: setLocale

 public static function setLocale($locale_arg = NULL, $category = LC_ALL)
 {
     Debug::Text('Generated/Passed In Locale: ' . $locale_arg, __FILE__, __LINE__, __METHOD__, 10);
     $locales = self::generateLocale($locale_arg);
     $locale = self::tryLocale($locales);
     unset($locales);
     Debug::Text('Attempting to set Locale(s) to: ' . $locale . ' Category: ' . $category . ' Current Locale: ' . self::getLocale(), __FILE__, __LINE__, __METHOD__, 10);
     if ($locale != self::getLocale() and in_array($category, array(LC_ALL, LC_MONETARY, LC_NUMERIC))) {
         Debug::Text('Setting currency/numeric Locale to: ' . $locale, __FILE__, __LINE__, __METHOD__, 10);
         //if ( self::getLocaleHandler()->setLocale( $locale, $category ) != $locale ) {
         //Setting the locale in Windows can cause the locale names to not match at all, so check for FALSE
         if (self::getLocaleHandler()->setLocale($locale, $category) == FALSE) {
             Debug::Text('Failed setting currency/numeric locale: ' . $locale, __FILE__, __LINE__, __METHOD__, 10);
         }
     }
     if ($locale != self::getLocale() and in_array($category, array(LC_ALL, LC_MESSAGES))) {
         // We normalize locales to a single "standard" locale for each lang
         // to avoid having to maintain lots of mostly duplicate translation files
         // for each lang/country combination.
         $normal_locale = self::_normalizeLocale($locale);
         Debug::Text('Setting translator to normalized locale: ' . $normal_locale, __FILE__, __LINE__, __METHOD__, 10);
         if (self::getTranslationHandler()->setLang($normal_locale) === FALSE) {
             //Fall back on non-normalized locale
             Debug::Text('Failed setting translator normalized locale: ' . $normal_locale . ' Falling back to: ' . $locale, __FILE__, __LINE__, __METHOD__, 10);
             if (self::getTranslationHandler()->setLang($locale) === FALSE) {
                 Debug::Text('Failed setting translator locale: ' . $locale, __FILE__, __LINE__, __METHOD__, 10);
                 return FALSE;
             }
         }
     }
     self::$locale = $locale;
     self::$language = substr($locale, 0, 2);
     //save language here to avoid becoming out of sync.
     if ($category == LC_ALL) {
         if (self::$master_locale == NULL) {
             self::$master_locale = $locale;
         }
     }
     Debug::Text('Set Master Locale To: ' . $locale, __FILE__, __LINE__, __METHOD__, 10);
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:41,代码来源:TTi18n.class.php


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