Esempio n. 1
0
 private function __load($path, $lang, $clear = false)
 {
     if ((bool) $clear === true || !self::$_dictionary instanceof Dictionary) {
         self::$_dictionary = new Dictionary(array());
         self::$_transliterations = array();
     }
     $include = sprintf($path, $lang);
     if (file_exists($include)) {
         require $include;
     }
     if (is_array($dictionary)) {
         self::$_dictionary->merge($dictionary);
     }
     if (is_array($transliterations)) {
         self::$_transliterations = array_merge(self::$_transliterations, $transliterations);
     }
     if (empty(self::$_transliterations)) {
         include TOOLKIT . '/include.transliterations.php';
         self::$_transliterations = $transliterations;
     }
 }
 /**
  * Initialize dictionary, transliterations and dates array
  */
 public static function initialize()
 {
     self::$_dictionary = new Dictionary();
     self::$_transliterations = array();
     self::$_dates = array();
 }
Esempio n. 3
0
 /**
  * Clear the current dictionary and transliteration arrays
  */
 public static function clear()
 {
     self::$_dictionary = new Dictionary(array());
     self::$_transliterations_character_replacements = array();
     self::$_transliterations_pattern_replacements = array();
 }
Esempio n. 4
0
 /**
  * Clear the current dictionary and transliteration arrays
  */
 public static function clear()
 {
     self::$_dictionary = new Dictionary(array());
     self::$_transliterations = array();
 }
 /**
  * Load language file. Each language file contains three arrays:
  * about, dictionary and transliterations.
  *
  * @param string $path
  *  Path of the language file that should be loaded
  */
 private static function load($path)
 {
     // Load language file
     if (file_exists($path)) {
         require $path;
     }
     // Populate dictionary ($dictionary is declared inside $path)
     if (isset($dictionary) && is_array($dictionary)) {
         self::$_dictionary = array_merge(self::$_dictionary, $dictionary);
     }
     // Populate transliterations ($transliterations is declared inside $path)
     if (isset($transliterations) && is_array($transliterations)) {
         self::$_transliterations = array_merge(self::$_transliterations, $transliterations);
     }
 }