Merge branch 'feature/bootstrap5' into nightly
This commit is contained in:
commit
b6760e19b7
2
data/web/css/build/007-languages.min.css
vendored
2
data/web/css/build/007-languages.min.css
vendored
File diff suppressed because one or more lines are too long
@ -180,9 +180,65 @@ 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));
|
// regex inspired from @GabrielAnderson on http://stackoverflow.com/questions/6038236/http-accept-language
|
||||||
if (array_key_exists($header_lang, $AVAILABLE_LANGUAGES)) {
|
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})*)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
||||||
$_SESSION['mailcow_locale'] = $header_lang;
|
|
||||||
|
$langs = $lang_parse[1];
|
||||||
|
$ranks = $lang_parse[4];
|
||||||
|
|
||||||
|
// (create an associative array 'language' => 'preference')
|
||||||
|
$lang2pref = array();
|
||||||
|
for ($i=0; $i<count($langs); $i++) {
|
||||||
|
$lang2pref[strtolower($langs[$i])] = (float) (!empty($ranks[$i]) ? $ranks[$i] : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// (comparison function for uksort)
|
||||||
|
$cmpLangs = function ($a, $b) use ($lang2pref) {
|
||||||
|
if ($lang2pref[$a] > $lang2pref[$b])
|
||||||
|
return -1;
|
||||||
|
elseif ($lang2pref[$a] < $lang2pref[$b])
|
||||||
|
return 1;
|
||||||
|
elseif (strlen($a) > strlen($b))
|
||||||
|
return -1;
|
||||||
|
elseif (strlen($a) < strlen($b))
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// sort the languages by prefered language and by the most specific region
|
||||||
|
uksort($lang2pref, $cmpLangs);
|
||||||
|
|
||||||
|
// generate language array without the region part
|
||||||
|
$AVAILABLE_BASE_LANGUAGES=array();
|
||||||
|
foreach ($AVAILABLE_LANGUAGES as $code => $lang) {
|
||||||
|
$base_code = substr($code, 0, 2);
|
||||||
|
if (!array_key_exists($base_code, $AVAILABLE_BASE_LANGUAGES)) {
|
||||||
|
$AVAILABLE_BASE_LANGUAGES[$base_code] = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find a perfect match or partial match
|
||||||
|
// Match en-gb or en
|
||||||
|
foreach ($lang2pref as $lang => $q) {
|
||||||
|
if (array_key_exists($lang, $AVAILABLE_LANGUAGES)) {
|
||||||
|
$_SESSION['mailcow_locale'] = $lang;
|
||||||
|
break;
|
||||||
|
} elseif (array_key_exists($lang, $AVAILABLE_BASE_LANGUAGES)) {
|
||||||
|
$_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[$lang];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try suggest match
|
||||||
|
// e.g. suggest en-gb when only en-us is provided
|
||||||
|
if (!isset($_COOKIE['mailcow_locale'])) {
|
||||||
|
foreach ($lang2pref as $lang => $q) {
|
||||||
|
if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) {
|
||||||
|
$_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -200,7 +256,7 @@ if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $AVAILABLE_LANGUAGES
|
|||||||
/*
|
/*
|
||||||
* load language
|
* load language
|
||||||
*/
|
*/
|
||||||
$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.json'), true);
|
$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en-gb.json'), true);
|
||||||
|
|
||||||
$langFile = $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.'.$_SESSION['mailcow_locale'].'.json';
|
$langFile = $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.'.$_SESSION['mailcow_locale'].'.json';
|
||||||
if(file_exists($langFile)) {
|
if(file_exists($langFile)) {
|
||||||
|
@ -76,33 +76,35 @@ $autodiscover_config = array(
|
|||||||
$DETECT_LANGUAGE = true;
|
$DETECT_LANGUAGE = true;
|
||||||
|
|
||||||
// Change default language
|
// Change default language
|
||||||
$DEFAULT_LANG = 'en';
|
$DEFAULT_LANG = 'en-gb';
|
||||||
|
|
||||||
// Available languages
|
// Available languages
|
||||||
// https://www.iso.org/obp/ui/#search
|
// https://www.iso.org/obp/ui/#search
|
||||||
// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
// https://en.wikipedia.org/wiki/IETF_language_tag
|
||||||
$AVAILABLE_LANGUAGES = array(
|
$AVAILABLE_LANGUAGES = array(
|
||||||
'cs' => 'Čeština (Czech)',
|
// 'ca-es' => 'Català (Catalan)',
|
||||||
'da' => 'Danish (Dansk)',
|
'cs-cz' => 'Čeština (Czech)',
|
||||||
'de' => 'Deutsch (German)',
|
'da-dk' => 'Danish (Dansk)',
|
||||||
'en' => 'English',
|
'de-de' => 'Deutsch (German)',
|
||||||
'es' => 'Español (Spanish)',
|
'en-gb' => 'English',
|
||||||
'fi' => 'Suomi (Finish)',
|
'es-es' => 'Español (Spanish)',
|
||||||
'fr' => 'Français (French)',
|
'fi-fi' => 'Suomi (Finish)',
|
||||||
'hu' => 'Magyar (Hungarian)',
|
'fr-fr' => 'Français (French)',
|
||||||
'it' => 'Italiano (Italian)',
|
'hu-hu' => 'Magyar (Hungarian)',
|
||||||
'ko' => '한국어 (Korean)',
|
'it-it' => 'Italiano (Italian)',
|
||||||
'lv' => 'latviešu (Latvian)',
|
'ko-kr' => '한국어 (Korean)',
|
||||||
'nl' => 'Nederlands (Dutch)',
|
'lv-lv' => 'latviešu (Latvian)',
|
||||||
'pl' => 'Język Polski (Polish)',
|
'nl-nl' => 'Nederlands (Dutch)',
|
||||||
'pt' => 'Português (Portuguese)',
|
'pl-pl' => 'Język Polski (Polish)',
|
||||||
'ro' => 'Română (Romanian)',
|
'pt-pt' => 'Português (Portuguese)',
|
||||||
'ru' => 'Pусский (Russian)',
|
'ro-ro' => 'Română (Romanian)',
|
||||||
'sk' => 'Slovenčina (Slovak)',
|
'ru-ru' => 'Pусский (Russian)',
|
||||||
'sv' => 'Svenska (Swedish)',
|
'sk-sk' => 'Slovenčina (Slovak)',
|
||||||
'tr' => 'Türkçe (Turkish)',
|
'sv-se' => 'Svenska (Swedish)',
|
||||||
'uk' => 'Українська (Ukrainian)',
|
'tr-tr' => 'Türkçe (Turkish)',
|
||||||
'zh' => '中文 (Chinese)'
|
'uk-ua' => 'Українська (Ukrainian)',
|
||||||
|
'zh-cn' => '简体中文 (Simplified Chinese)',
|
||||||
|
'zh-tw' => '繁體中文 (Traditional Chinese)',
|
||||||
);
|
);
|
||||||
|
|
||||||
// default theme is lumen
|
// default theme is lumen
|
||||||
|
@ -487,6 +487,7 @@
|
|||||||
"containers_info": "Container-Information",
|
"containers_info": "Container-Information",
|
||||||
"container_running": "Läuft",
|
"container_running": "Läuft",
|
||||||
"container_stopped": "Angehalten",
|
"container_stopped": "Angehalten",
|
||||||
|
"cores": "Kerne",
|
||||||
"current_time": "Systemzeit",
|
"current_time": "Systemzeit",
|
||||||
"disk_usage": "Festplattennutzung",
|
"disk_usage": "Festplattennutzung",
|
||||||
"docs": "Dokumente",
|
"docs": "Dokumente",
|
||||||
@ -511,7 +512,7 @@
|
|||||||
"success": "Erfolg",
|
"success": "Erfolg",
|
||||||
"system_containers": "System & Container",
|
"system_containers": "System & Container",
|
||||||
"timezone": "Zeitzone",
|
"timezone": "Zeitzone",
|
||||||
"uptime": "Uptime",
|
"uptime": "Betriebszeit",
|
||||||
"update_available": "Es ist ein Update verfügbar",
|
"update_available": "Es ist ein Update verfügbar",
|
||||||
"no_update_available": "Das System ist auf aktuellem Stand",
|
"no_update_available": "Das System ist auf aktuellem Stand",
|
||||||
"update_failed": "Es konnte nicht nach einem Update gesucht werden",
|
"update_failed": "Es konnte nicht nach einem Update gesucht werden",
|
@ -487,6 +487,7 @@
|
|||||||
"containers_info": "Container information",
|
"containers_info": "Container information",
|
||||||
"container_running": "Running",
|
"container_running": "Running",
|
||||||
"container_stopped": "Stopped",
|
"container_stopped": "Stopped",
|
||||||
|
"cores": "Cores",
|
||||||
"current_time": "System Time",
|
"current_time": "System Time",
|
||||||
"disk_usage": "Disk usage",
|
"disk_usage": "Disk usage",
|
||||||
"docs": "Docs",
|
"docs": "Docs",
|
1187
data/web/lang/lang.zh-tw.json
Normal file
1187
data/web/lang/lang.zh-tw.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -45,12 +45,12 @@
|
|||||||
</li>
|
</li>
|
||||||
{% if mailcow_locale %}
|
{% if mailcow_locale %}
|
||||||
<li class="nav-item dropdown{% if available_languages|length == 1 %}lang-link-disabled{% endif %}">
|
<li class="nav-item dropdown{% if available_languages|length == 1 %}lang-link-disabled{% endif %}">
|
||||||
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false"><span class="flag-icon flag-icon-{{ mailcow_locale }}"></span></a>
|
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false"><span class="flag-icon flag-icon-{{ mailcow_locale[-2:] }}"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu "aria-labelledby="languageDropdown">
|
<ul class="dropdown-menu" role="menu "aria-labelledby="languageDropdown">
|
||||||
{% for key, val in available_languages %}
|
{% for key, val in available_languages %}
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item {% if mailcow_locale == key %}active{% endif %}" href="?{{ query_string({'lang': key}) }}">
|
<a class="dropdown-item {% if mailcow_locale == key %}active{% endif %}" 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 %}
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
<td id="host_uptime" class="text-break">-</td>
|
<td id="host_uptime" class="text-break">-</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Disk Info</td>
|
<td>{{ lang.debug.disk_usage }}</td>
|
||||||
<td class="text-break">
|
<td class="text-break">
|
||||||
<div>
|
<div>
|
||||||
<span class="d-block"><i class="bi bi-hdd-fill"></i> {{ vmail_df[0] }}</span>
|
<span class="d-block"><i class="bi bi-hdd-fill"></i> {{ vmail_df[0] }}</span>
|
||||||
@ -104,11 +104,11 @@
|
|||||||
|
|
||||||
<div class="col-sm-6 mt-4">
|
<div class="col-sm-6 mt-4">
|
||||||
<h3>CPU</h3>
|
<h3>CPU</h3>
|
||||||
<h5><span id="host_cpu_cores">-</span> Cores @ <span id="host_cpu_usage"></span></h5>
|
<h5><span id="host_cpu_cores">-</span> {{ lang.debug.cores }} @ <span id="host_cpu_usage"></span></h5>
|
||||||
<canvas id="host_cpu_chart" width="400" height="200"></canvas>
|
<canvas id="host_cpu_chart" width="400" height="200"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 mt-4">
|
<div class="col-sm-6 mt-4">
|
||||||
<h3>MEMORY</h3>
|
<h3>{{ lang.debug.memory|upper}}</h3>
|
||||||
<h5><span id="host_memory_total">-</span> @ <span id="host_memory_usage"></span></h5>
|
<h5><span id="host_memory_total">-</span> @ <span id="host_memory_usage"></span></h5>
|
||||||
<canvas id="host_mem_chart" width="400" height="200"></canvas>
|
<canvas id="host_mem_chart" width="400" height="200"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,13 +49,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if not oauth2_request %}
|
{% if not oauth2_request %}
|
||||||
<button type="button" {% if available_languages|length == 1 %}disabled="true"{% endif %} class="btn btn-xs-lg btn-secondary ms-auto dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button type="button" {% if available_languages|length == 1 %}disabled="true"{% endif %} class="btn btn-xs-lg btn-secondary ms-auto dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<span class="flag-icon flag-icon-{{ mailcow_locale }}"></span>
|
<span class="flag-icon flag-icon-{{ mailcow_locale[-2:] }}"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu ms-auto login">
|
<ul class="dropdown-menu ms-auto login">
|
||||||
{% for key, val in available_languages %}
|
{% for key, val in available_languages %}
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item {% if mailcow_locale == key %}active{% endif %}" href="?{{ query_string({'lang': key}) }}">
|
<a class="dropdown-item {% if mailcow_locale == key %}active{% endif %}" 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 %}
|
||||||
|
@ -3,15 +3,22 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="mail-content" class="responsive-tabs">
|
<div id="mail-content" class="responsive-tabs">
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li class="nav-item" role="presentation"><button class="nav-link active" aria-selected="false" aria-controls="tab-domains" role="tab" data-bs-toggle="tab" data-bs-target="#tab-domains">{{ lang.mailbox.domains }}</button></li>
|
<li class="nav-item dropdown" role="presentation">
|
||||||
<li class="nav-item" role="presentation"><button class="nav-link" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailboxes">{{ lang.mailbox.mailboxes }}</button></li>
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.mailbox.domains }}</a>
|
||||||
{# <li class="nav-item dropdown" role="presentation">
|
<ul class="dropdown-menu">
|
||||||
|
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-domains">{{ lang.mailbox.domains }}</button></li>
|
||||||
|
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailbox-defaults" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailbox-defaults">Default settings</button></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{# <li class="nav-item" role="presentation"><button class="nav-link active" aria-selected="false" aria-controls="tab-domains" role="tab" data-bs-toggle="tab" data-bs-target="#tab-domains">{{ lang.mailbox.domains }}</button></li> #}
|
||||||
|
{# <li class="nav-item" role="presentation"><button class="nav-link" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailboxes">{{ lang.mailbox.mailboxes }}</button></li> #}
|
||||||
|
<li class="nav-item dropdown" role="presentation">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.mailbox.mailboxes }}</a>
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.mailbox.mailboxes }}</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailboxes">{{ lang.mailbox.mailboxes }}</button></li>
|
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailboxes">{{ lang.mailbox.mailboxes }}</button></li>
|
||||||
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailbox-defaults" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailbox-defaults">{{ lang.mailbox.mailbox_defaults }}</button></li>
|
<li><button class="dropdown-item" aria-selected="false" aria-controls="tab-mailbox-defaults" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailbox-defaults">{{ lang.mailbox.mailbox_defaults }}</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li> #}
|
</li>
|
||||||
<li class="nav-item" role="presentation"><button class="nav-link" aria-controls="tab-resources" role="tab" data-bs-toggle="tab" data-bs-target="#tab-resources">{{ lang.mailbox.resources }}</button></li>
|
<li class="nav-item" role="presentation"><button class="nav-link" aria-controls="tab-resources" role="tab" data-bs-toggle="tab" data-bs-target="#tab-resources">{{ lang.mailbox.resources }}</button></li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" data-bs-target="#">{{ lang.mailbox.aliases }}</a>
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" data-bs-target="#">{{ lang.mailbox.aliases }}</a>
|
||||||
|
@ -26,7 +26,7 @@ if(empty($targetLang)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load master lang
|
// load master lang
|
||||||
$masterLang = file_get_contents(__DIR__.'/../data/web/lang/lang.en.json');
|
$masterLang = file_get_contents(__DIR__.'/../data/web/lang/lang.en-gb.json');
|
||||||
$masterLang = json_decode($masterLang, true);
|
$masterLang = json_decode($masterLang, true);
|
||||||
|
|
||||||
// load target lang
|
// load target lang
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
MASTER="en"
|
MASTER="en-gb"
|
||||||
|
|
||||||
DIR = "#{__dir__}/.."
|
DIR = "#{__dir__}/.."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user