introduce json-files for translations (#3120)
* introduce json-files for translations to structure data and add ability using translation managements * Translated using Weblate (Italian) Currently translated at 40.1% (342 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/it/ * Translated using Weblate (Catalan) Currently translated at 58.3% (497 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/ca/ * Translated using Weblate (Polish) Currently translated at 45.3% (386 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/pl/ * Translated using Weblate (Latvian) Currently translated at 59.0% (503 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/lv/ * Translated using Weblate (Portuguese) Currently translated at 27.5% (234 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/pt/ * Translated using Weblate (Russian) Currently translated at 45.4% (387 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/ru/ * Translated using Weblate (German) Currently translated at 99.9% (851 of 852 strings) Translation: test/mailcow Translate-URL: http://192.168.178.22:8080/projects/test/mailcow/de/ * removed empty and unused text user_change_fn * removed empty and unused text user_change_fn II
This commit is contained in:
14
data/web/inc/lib/array_merge_real.php
Normal file
14
data/web/inc/lib/array_merge_real.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
function array_merge_real()
|
||||
{
|
||||
$output = [];
|
||||
foreach (func_get_args() as $array) {
|
||||
foreach ($array as $key => $value) {
|
||||
$output[$key] = isset($output[$key]) ?
|
||||
array_merge($output[$key], $value) : $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
@@ -23,6 +23,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/sieve/SieveParser.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/JSminifierExtended.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/CSSminifierExtended.php';
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/array_merge_real.php';
|
||||
|
||||
// Minify JS
|
||||
use MatthiasMullie\Minify;
|
||||
$js_minifier = new JSminifierExtended();
|
||||
@@ -142,7 +144,7 @@ set_exception_handler('exception_handler');
|
||||
// TODO: Move function
|
||||
function get_remote_ip($anonymize = null) {
|
||||
global $ANONYMIZE_IPS;
|
||||
if ($anonymize === null) {
|
||||
if ($anonymize === null) {
|
||||
$anonymize = $ANONYMIZE_IPS;
|
||||
}
|
||||
elseif ($anonymize !== true && $anonymize !== false) {
|
||||
@@ -191,8 +193,16 @@ if (isset($_GET['lang']) && in_array($_GET['lang'], $AVAILABLE_LANGUAGES)) {
|
||||
setcookie("mailcow_locale", $_GET['lang'], time()+30758400); // one year
|
||||
}
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.php';
|
||||
include $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.'.$_SESSION['mailcow_locale'].'.php';
|
||||
/*
|
||||
* load language
|
||||
*/
|
||||
$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.json'), true);
|
||||
|
||||
$langFile = $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.'.$_SESSION['mailcow_locale'].'.json';
|
||||
if(file_exists($langFile)) {
|
||||
$lang = array_merge_real($lang, json_decode(file_get_contents($langFile), true));
|
||||
}
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.inc.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.acl.inc.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.mailbox.inc.php';
|
||||
|
Reference in New Issue
Block a user