i18n: Add english as always available, and merge other languages in case of missing keys

Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
Marco Dickert 2020-08-04 21:09:01 +02:00
parent 6bbd02339b
commit e014781af4
3 changed files with 10 additions and 2 deletions

View File

@ -38,6 +38,10 @@ foreach ($options as $key => $value)
$langs = array_merge($langs, explode(",", $value));
$langs = array_unique($langs);
$vars['default_lang'] = ($langs[0] == "all") ? "en" : $langs[0];
// ensure english is available, as it gets merged with the other languages
// in case of missing keys in other languages.
if (!in_array("all", $langs) || !in_array("en", $langs))
array_push($langs, "en");
if (in_array("all", $langs))
$langs = array_map(

3
docker/php.ini Normal file
View File

@ -0,0 +1,3 @@
max_execution_time = 0
upload_max_filesize = 0
post_max_size = 0

View File

@ -184,9 +184,10 @@ f00bar;
$this->i18n = $i18n;
if( in_array( $this->config['language'], array_keys( $this->i18n ) ) )
$this->l = $this->i18n[$this->config['language']];
// Merge english with the language in case of missing keys
$this->l = (object)array_merge((array)$this->i18n['en'], (array)$this->i18n[$this->config['language']]);
else
$this->l = reset($this->i18n);
$this->l = $this->i18n['en'];
if ($this->config['timezone'])
date_default_timezone_set($this->config['timezone']);