Merge pull request #662 from yrammos/auto-select-browser-lang

Automatically detect the client's language
This commit is contained in:
Alex Tselegidis 2020-03-10 21:16:24 +01:00 committed by GitHub
commit 259ef17a55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,38 @@ $config['url_suffix'] = '';
|
*/
$config['language'] = defined('Config::LANGUAGE') ? Config::LANGUAGE : 'english';
$config['language'] = (null !== $_SERVER['HTTP_ACCEPT_LANGUAGE']
?
array(
'ar' => 'arabic',
'bu' => 'bulgarian',
'zh' => 'chinese',
'da' => 'danish',
'nl' => 'dutch',
'en' => 'english',
'fi' => 'finnish',
'fr' => 'french',
'de' => 'german',
'el' => 'greek',
'hi' => 'hindi',
'hu' => 'hungarian',
'it' => 'italian',
'ja' => 'japanese',
'pl' => 'polish',
'pt' => 'portuguese',
'pt' => 'portuguese',
'ro' => 'romanian',
'ru' => 'russian',
'sk' => 'slovak',
'es' => 'spanish',
'tr' => 'turkish'
)[substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)]
:
(defined('Config::LANGUAGE')
? Config::LANGUAGE
: 'english'
)
);
/*
|--------------------------------------------------------------------------