Fix i18n.php review comments

Use the DEFAULT_LANGUAGE as the default in locale_lookup.
This commit is contained in:
Nicolas Bouilleaud 2019-04-19 11:50:42 +02:00
parent 20240fee15
commit 94739ba971

View file

@ -38,7 +38,7 @@ class __i18n {
public static function translate($key) {
if (!isset(self::$translator)) {
global $locale, $ALLOWED_LANGUAGES;
$found_locale = locale_lookup(array_keys($ALLOWED_LANGUAGES), $locale);
$found_locale = locale_lookup(array_keys($ALLOWED_LANGUAGES), $locale, false, DEFAULT_LANGUAGE);
self::$translator = new Translator($found_locale);
self::$translator->addLoader('pofile', new PoFileLoader());
self::$translator->addResource('pofile', ROOT_DIR . "po/{$found_locale}.po", $found_locale);