Fix compile if no language selected

This commit is contained in:
Dmitriy Novash 2020-10-01 11:32:54 +03:00
parent 84152e3296
commit c73fe8b4c1
No known key found for this signature in database
GPG Key ID: D350E5788583C8BA

View File

@ -37,7 +37,11 @@ foreach ($options as $key => $value)
if (substr($key, 0, 4) == "lang")
$langs = array_merge($langs, explode(",", $value));
$langs = array_unique($langs);
$vars['default_lang'] = ($langs[0] == "all") ? "en" : $langs[0];
if (!empty($langs)) {
$vars['default_lang'] = ($langs[0] == "all") ? "en" : $langs[0];
} else {
$vars['default_lang'] = "en";
}
// 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))