diff --git a/application/config/config.php b/application/config/config.php index f41240a464..27f20003ba 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -115,12 +115,16 @@ 'tr' => 'turkish', ]; +$config['language_codes'] = $languages; + $language_code = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : 'en'; $config['language'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages[$language_code]) ? $languages[$language_code] : Config::LANGUAGE; +$config['language_code'] = array_search($config['language'], $languages) ?: 'en'; + /* |-------------------------------------------------------------------------- | Available Languages diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index ff4e5cce39..e836d46f12 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -97,7 +97,12 @@ private function configure_language() if ($session_language) { - config(['language' => $session_language]); + $language_codes = config('language_codes'); + + config([ + 'language' => $session_language, + 'language_code' => array_search($session_language, $language_codes) ?: 'en' + ]); } $this->lang->load('translations'); diff --git a/application/views/layouts/account_layout.php b/application/views/layouts/account_layout.php index 38ea729f2b..7a3d5aaf85 100644 --- a/application/views/layouts/account_layout.php +++ b/application/views/layouts/account_layout.php @@ -1,5 +1,5 @@ - + diff --git a/application/views/layouts/backend_layout.php b/application/views/layouts/backend_layout.php index 4b69ee2f1b..fcaae375be 100644 --- a/application/views/layouts/backend_layout.php +++ b/application/views/layouts/backend_layout.php @@ -1,5 +1,5 @@ - + diff --git a/application/views/layouts/booking_layout.php b/application/views/layouts/booking_layout.php index fc19f653a9..25051685d2 100644 --- a/application/views/layouts/booking_layout.php +++ b/application/views/layouts/booking_layout.php @@ -1,5 +1,5 @@ - + diff --git a/application/views/layouts/message_layout.php b/application/views/layouts/message_layout.php index 899bf111d2..2106503ded 100644 --- a/application/views/layouts/message_layout.php +++ b/application/views/layouts/message_layout.php @@ -1,5 +1,5 @@ - +