From e89686c6b3e9d7f77a5d6b2aee17e73ec76a80e1 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 22 Jul 2024 10:15:28 +0200 Subject: [PATCH] Set the displayed language with a URL query parameter (#1566) --- application/config/config.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index adefd2fc..5023e7aa 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -125,9 +125,11 @@ $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'] = + $_GET['language'] ?? + (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages[$language_code]) + ? $languages[$language_code] + : Config::LANGUAGE); $config['language_code'] = array_search($config['language'], $languages) ?: 'en';