From b6a17d4e11ed71af53f626cf313a10c76d815bc1 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 22 Mar 2021 19:18:38 +0100 Subject: [PATCH] Missing language mappings would cause issues with the auto-detection of the user's language. --- application/config/config.php | 60 ++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index ddf01caa..8a5ed78d 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -82,32 +82,40 @@ $config['url_suffix'] = ''; | */ -$config['language'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? - [ - 'ar' => 'arabic', - 'bu' => 'bulgarian', - 'zh' => 'chinese', - 'da' => 'danish', - 'nl' => 'dutch', - 'en' => 'english', - 'fi' => 'finnish', - 'fr' => 'french', - 'de' => 'german', - 'el' => 'greek', - 'he' => 'hebrew', - 'hi' => 'hindi', - 'hu' => 'hungarian', - 'it' => 'italian', - 'ja' => 'japanese', - 'pl' => 'polish', - 'pt' => 'portuguese', - 'ro' => 'romanian', - 'ru' => 'russian', - 'sk' => 'slovak', - 'es' => 'spanish', - 'tr' => 'turkish', - 'sv' => 'swedish' - ][substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)] +$languages = [ + 'ar' => 'arabic', + 'bu' => 'bulgarian', + 'ca' => 'catalan', + 'zh' => 'chinese', + 'cs' => 'czech', + 'da' => 'danish', + 'nl' => 'dutch', + 'en' => 'english', + 'fi' => 'finnish', + 'fr' => 'french', + 'de' => 'german', + 'el' => 'greek', + 'he' => 'hebrew', + 'hi' => 'hindi', + 'hu' => 'hungarian', + 'it' => 'italian', + 'ja' => 'japanese', + 'lb' => 'luxembourgish', + 'mr' => 'marathi', + 'pl' => 'polish', + 'pt' => 'portuguese', + 'ro' => 'romanian', + 'ru' => 'russian', + 'sk' => 'slovak', + 'es' => 'spanish', + 'sv' => 'swedish', + 'tr' => 'turkish', +]; + +$language_code = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + +$config['language'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages[$language_code]) + ? $languages[$language_code] : Config::LANGUAGE; /*