protected static function setupI18n()
 {
     if (TBGContext::isCLI()) {
         return null;
     }
     $language = self::$_user instanceof TBGUser ? self::$_user->getLanguage() : 'en_US';
     if (self::$_user instanceof TBGUser && self::$_user->getLanguage() == 'sys') {
         $language = 'en_US';
     }
     TBGLogging::log('Loading i18n strings');
     if (!(self::$_i18n = TBGCache::get("i18n_{$language}"))) {
         TBGLogging::log("Loading strings from file ({$language})");
         self::$_i18n = new TBGI18n($language);
         self::$_i18n->initialize();
         TBGCache::add("i18n_{$language}", self::$_i18n);
     } else {
         TBGLogging::log('Using cached i18n strings');
     }
     TBGLogging::log('...done');
 }
Esempio n. 2
0
 protected static function setupI18n()
 {
     TBGLogging::log('Initializing i18n');
     if (!TBGContext::isCLI()) {
         $language = self::$_user instanceof TBGUser ? self::$_user->getLanguage() : TBGSettings::getLanguage();
         if (self::$_user instanceof TBGUser && self::$_user->getLanguage() == 'sys') {
             $language = TBGSettings::getLanguage();
         }
         TBGLogging::log('Loading i18n strings');
         if (!(self::$_i18n = TBGCache::get(TBGCache::KEY_I18N . $language, false))) {
             TBGLogging::log("Loading strings from file ({$language})");
             self::$_i18n = new TBGI18n($language);
             if (!self::isInstallmode()) {
                 TBGCache::add(TBGCache::KEY_I18N . $language, self::$_i18n, false);
             }
         } else {
             TBGLogging::log('Using cached i18n strings');
         }
         self::$_i18n->initialize();
     }
     TBGLogging::log('done (initializing i18n)');
 }