Switch language key

zh_Hans -> zh-cn
zh_Hant -> zh-tw
This commit is contained in:
Tomy Hsieh 2022-07-02 17:01:50 +08:00
parent bd23b80d45
commit 88d7593d89
No known key found for this signature in database
GPG Key ID: 9E47A53D54F34479
6 changed files with 5 additions and 5 deletions

View File

@ -194,7 +194,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php';
// Set language // Set language
if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) { if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) {
if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 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)) { if (array_key_exists($header_lang, $AVAILABLE_LANGUAGES)) {
$_SESSION['mailcow_locale'] = $header_lang; $_SESSION['mailcow_locale'] = $header_lang;
} }

View File

@ -101,8 +101,8 @@ $AVAILABLE_LANGUAGES = array(
'sk' => 'Slovenčina (Slovak)', 'sk' => 'Slovenčina (Slovak)',
'sv' => 'Svenska (Swedish)', 'sv' => 'Svenska (Swedish)',
'uk' => 'Українська (Ukrainian)', 'uk' => 'Українська (Ukrainian)',
'zh_Hans' => '简体中文 (Simplified Chinese)', 'zh-cn' => '简体中文 (Simplified Chinese)',
'zh_Hant' => '繁體中文 (Traditional Chinese)', 'zh-tw' => '繁體中文 (Traditional Chinese)',
); );
// Change theme (default: lumen) // Change theme (default: lumen)

View File

@ -37,7 +37,7 @@
{% for key, val in available_languages %} {% for key, val in available_languages %}
<li{% if mailcow_locale == key %} class="active"{% endif %}> <li{% if mailcow_locale == key %} class="active"{% endif %}>
<a href="?{{ query_string({'lang': key}) }}"> <a href="?{{ query_string({'lang': key}) }}">
<span class="flag-icon flag-icon-{{ key }}"></span>{{ val }} <span class="flag-icon flag-icon-{{ key[-2:] }}"></span>{{ val }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -51,7 +51,7 @@
{% for key, val in available_languages %} {% for key, val in available_languages %}
<li{% if mailcow_locale == key %} class="active"{% endif %}> <li{% if mailcow_locale == key %} class="active"{% endif %}>
<a href="?{{ query_string({'lang': key}) }}"> <a href="?{{ query_string({'lang': key}) }}">
<span class="flag-icon flag-icon-{{ key }}"></span>{{ val }} <span class="flag-icon flag-icon-{{ key[-2:] }}"></span>{{ val }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}