From 88d7593d8929248a873a33c32d928dc9ab2ece9e Mon Sep 17 00:00:00 2001 From: Tomy Hsieh Date: Sat, 2 Jul 2022 17:01:50 +0800 Subject: [PATCH] Switch language key zh_Hans -> zh-cn zh_Hant -> zh-tw --- data/web/inc/prerequisites.inc.php | 2 +- data/web/inc/vars.inc.php | 4 ++-- data/web/lang/{lang.zh_Hans.json => lang.zh-cn.json} | 0 data/web/lang/{lang.zh_Hant.json => lang.zh-tw.json} | 0 data/web/templates/base.twig | 2 +- data/web/templates/index.twig | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename data/web/lang/{lang.zh_Hans.json => lang.zh-cn.json} (100%) rename data/web/lang/{lang.zh_Hant.json => lang.zh-tw.json} (100%) diff --git a/data/web/inc/prerequisites.inc.php b/data/web/inc/prerequisites.inc.php index 6cfdd1ca..b9737d64 100644 --- a/data/web/inc/prerequisites.inc.php +++ b/data/web/inc/prerequisites.inc.php @@ -194,7 +194,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php'; // Set language if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) { if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $header_lang = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); + $header_lang = strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']); if (array_key_exists($header_lang, $AVAILABLE_LANGUAGES)) { $_SESSION['mailcow_locale'] = $header_lang; } diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 06783972..177c7dd9 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -101,8 +101,8 @@ $AVAILABLE_LANGUAGES = array( 'sk' => 'Slovenčina (Slovak)', 'sv' => 'Svenska (Swedish)', 'uk' => 'Українська (Ukrainian)', - 'zh_Hans' => '简体中文 (Simplified Chinese)', - 'zh_Hant' => '繁體中文 (Traditional Chinese)', + 'zh-cn' => '简体中文 (Simplified Chinese)', + 'zh-tw' => '繁體中文 (Traditional Chinese)', ); // Change theme (default: lumen) diff --git a/data/web/lang/lang.zh_Hans.json b/data/web/lang/lang.zh-cn.json similarity index 100% rename from data/web/lang/lang.zh_Hans.json rename to data/web/lang/lang.zh-cn.json diff --git a/data/web/lang/lang.zh_Hant.json b/data/web/lang/lang.zh-tw.json similarity index 100% rename from data/web/lang/lang.zh_Hant.json rename to data/web/lang/lang.zh-tw.json diff --git a/data/web/templates/base.twig b/data/web/templates/base.twig index 08376e71..f816d6cc 100644 --- a/data/web/templates/base.twig +++ b/data/web/templates/base.twig @@ -37,7 +37,7 @@ {% for key, val in available_languages %} - {{ val }} + {{ val }} {% endfor %} diff --git a/data/web/templates/index.twig b/data/web/templates/index.twig index 056421fe..653b65c4 100644 --- a/data/web/templates/index.twig +++ b/data/web/templates/index.twig @@ -51,7 +51,7 @@ {% for key, val in available_languages %} - {{ val }} + {{ val }} {% endfor %}