🛠 fix: Locale decision algorithm

This commit is contained in:
Tomy Hsieh 2022-12-25 16:56:43 +08:00 committed by GitHub
parent 355da03fba
commit 13bdd4ad0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,7 +234,7 @@ if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) {
// Try suggest match // Try suggest match
// e.g. suggest en-gb when only en-us is provided // e.g. suggest en-gb when only en-us is provided
if (!isset($_COOKIE['mailcow_locale'])) { if (!isset($_SESSION['mailcow_locale'])) {
foreach ($lang2pref as $lang => $q) { foreach ($lang2pref as $lang => $q) {
if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) { if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) {
$_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)]; $_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)];