/** * The function sets current localization. * * @static * @access private */ private static function initLocale() { $locales = explode(',', Config::get('l10n', 'en_US')); $current = isset($locales[0]) ? $locales[0] : 'en_US'; $arr = explode(',', Request::get('HTTP_ACCEPT_LANGUAGE', '', 'SERVER')); foreach ($arr as $locale) { if (strlen($locale) == 5) { $locale = strtolower(substr($locale, 0, 2)) . '_' . strtoupper(substr($locale, 3, 2)); if (in_array($locale, $locales)) { $current = $locale; break; } } if (strlen($locale) == 2) { foreach ($locales as $item) { if (strtolower($locale) == substr($item, 0, 2)) { $current = $item; break; } } } } Locale::set($current); Locale::$TEST_MODE = !Config::get('l10n@smooth', false); ISO_Table::setLocale(Locale::get()); Locale::load('Common'); }
/** * Override constructor. Prepare short codes after data is loaded. */ public function __construct() { parent::__construct(); $this->prepareShort(); }
/** * The function sets current locale for all ISO tables. * * @static * @access public * @param string $locale The locale. */ public static function setLocale($locale = null) { self::$locale = $locale; }
/** * @see ISO_Table::get() */ public function get($code, $key = 'name') { return parent::get(strtoupper($code), $key); }