diff --git a/i18n/I18N.php b/i18n/I18N.php index 08a2294..e4f0f25 100644 --- a/i18n/I18N.php +++ b/i18n/I18N.php @@ -49,12 +49,16 @@ class I18N self::$lang = Env::Cookie('lang', self::getAcceptLanguage()); self::setLang(self::$lang); self::$locale = self::$locales[self::$lang]; - - putenv('LANG=' . self::$locale); - setlocale(LC_ALL, self::$locale . '.UTF-8'); + self::initForLocale(self::$locale); + } + + static public function initForLocale($locale) + { + putenv('LANG=' . $locale); + setlocale(LC_ALL, $locale . '.UTF-8'); bindtextdomain(self::$domain, PATH . '/' . APP . '/src/i18n/'); textdomain(self::$domain); - bind_textdomain_codeset(self::$domain, 'UTF-8'); + bind_textdomain_codeset(self::$domain, 'UTF-8'); } static protected function getAcceptLanguage()