public static function load($lang) { if (!self::$_init) { I18n::init(); } if (isset(self::$_cache[$lang])) { return self::$_cache[$lang]; } // New translation table $table = array(); // Split the language: language, region, locale, etc. $parts = explode('-', $lang); do { // Create a path for this set of parts $file = self::$_locale_dir . implode('-', $parts) . '.yml'; if (file_exists($file)) { // Load and parse YAML-formatted file $yaml = Yaml::parse(file_get_contents($file)); // Recursively merge language with table $table = Util::array_merge($table, $yaml[implode('-', $parts)]); } // Remove the last part array_pop($parts); } while ($parts); // Cache the translation table locally return self::$_cache[$lang] = $table; }
public function setUp() { $this->generate = Phaker::factory('lorem'); $this->standard_wordlist = I18n::get('faker.lorem.words'); $this->complete_wordlist = Util::array_merge($this->standard_wordlist, I18n::get('faker.lorem.supplemental')); }