|
@@ -213,30 +213,32 @@ namespace Memcache_UI\Core {
|
|
|
'@intl' => 'intl',
|
|
|
)), LOG_WARNING);
|
|
|
}
|
|
|
+ else {
|
|
|
+ $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
|
|
|
- $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
- $this->setMessage(strtr('Requested locale: @locale', array('@locale' => $locale)), LOG_DEBUG);
|
|
|
- if (!empty($locale)) {
|
|
|
- $matches = array();
|
|
|
- $count = preg_match('/^([a-z]{2}_[A-Z]{2})(\.(\w+))*/', $locale, $matches);
|
|
|
- if ($count) {
|
|
|
- $count = count($matches);
|
|
|
- }
|
|
|
- $locale = $count >= 2
|
|
|
- ? $matches[1]
|
|
|
- : 'en_US';
|
|
|
- $codeset = $count >= 4
|
|
|
- ? $matches[3]
|
|
|
- : 'UTF8';
|
|
|
- self::$locale = $locale . '.' . $codeset;
|
|
|
- setlocale(LC_ALL, self::$locale);
|
|
|
+ $this->setMessage(strtr('Requested locale: @locale', array('@locale' => $locale)), LOG_DEBUG);
|
|
|
+ if (!empty($locale)) {
|
|
|
+ $matches = array();
|
|
|
+ $count = preg_match('/^([a-z]{2}_[A-Z]{2})(\.(\w+))*/', $locale, $matches);
|
|
|
+ if ($count) {
|
|
|
+ $count = count($matches);
|
|
|
+ }
|
|
|
+ $locale = $count >= 2
|
|
|
+ ? $matches[1]
|
|
|
+ : 'en_US';
|
|
|
+ $codeset = $count >= 4
|
|
|
+ ? $matches[3]
|
|
|
+ : 'UTF8';
|
|
|
+ self::$locale = $locale . '.' . $codeset;
|
|
|
+ setlocale(LC_ALL, self::$locale);
|
|
|
|
|
|
- $domain = 'messages';
|
|
|
- $translation_path = 'locale';
|
|
|
- bindtextdomain($domain, $translation_path);
|
|
|
- textdomain($domain);
|
|
|
- bind_textdomain_codeset($domain, 'UTF8');
|
|
|
- $this->setMessage(self::t('Locale: @locale', array('@locale' => self::$locale)), LOG_DEBUG);
|
|
|
+ $domain = 'messages';
|
|
|
+ $translation_path = 'locale';
|
|
|
+ bindtextdomain($domain, $translation_path);
|
|
|
+ textdomain($domain);
|
|
|
+ bind_textdomain_codeset($domain, 'UTF8');
|
|
|
+ $this->setMessage(self::t('Locale: @locale', array('@locale' => self::$locale)), LOG_DEBUG);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|