Ejemplo n.º 1
0
 /**
  * Load specified language file
  */
 public static function load($path, $lang, $clear = false)
 {
     if ((bool) $clear === true || !self::$_dictionary instanceof Dictionary) {
         Lang::clear();
     }
     $include = sprintf($path, $lang);
     if (file_exists($include)) {
         require $include;
     }
     if (isset($dictionary) && is_array($dictionary)) {
         self::$_dictionary->merge($dictionary);
     }
     if (isset($transliterations) && is_array($transliterations)) {
         self::$_transliterations = array_merge(self::$_transliterations, $transliterations);
     }
     if (empty(self::$_transliterations)) {
         include TOOLKIT . '/include.transliterations.php';
         self::$_transliterations = $transliterations;
     }
 }
Ejemplo n.º 2
0
 public function reloadLangFromAuthorPreference()
 {
     $lang = $this->Author->get('language');
     if ($lang && $lang != self::lang()) {
         self::$_lang = $lang;
         if ($lang != 'en') {
             Lang::loadAll($this->ExtensionManager);
         } else {
             // As there is no English dictionary the default dictionary needs to be cleared
             Lang::clear();
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Load specified language file
  */
 public static function load($path, $lang, $clear = false)
 {
     if ((bool) $clear === true || !self::$_dictionary instanceof Dictionary) {
         Lang::clear();
     }
     $include = sprintf($path, $lang);
     if (is_file($include)) {
         require $include;
     }
     if (isset($dictionary) && is_array($dictionary)) {
         self::$_dictionary->merge($dictionary);
     }
     if (isset($characters) && is_array($characters)) {
         self::$_transliterations_character_replacements = array_merge(self::$_transliterations_character_replacements, $characters);
     }
     if (isset($patterns) && is_array($patterns)) {
         self::$_transliterations_pattern_replacements = array_merge(self::$_transliterations_pattern_replacements, $patterns);
     }
     /*
     			if(empty(self::$_transliterations_character_replacements)) {
     				include(LIB . '/include.transliterations.php');
     				self::$_transliterations_character_replacements = $characters;
     			}
     
     			if(empty(self::$_transliterations_pattern_replacements)) {
     				include(LIB . '/include.transliterations.php');
     				self::$_transliterations_pattern_replacements = $patterns;
     			}
     */
 }
Ejemplo n.º 4
0
 public function reloadLangFromUserPreference()
 {
     $lang = $this->User->language;
     if ($lang && $lang != self::lang()) {
         self::$_lang = $lang;
         if ($lang != 'en') {
             Lang::loadAll();
         } else {
             // As there is no English dictionary the default dictionary needs to be cleared
             Lang::clear();
         }
     }
 }