|
|
@@ -84,6 +84,10 @@ class Minz_Translate {
|
|
|
return array_values(array_unique($list_langs));
|
|
|
}
|
|
|
|
|
|
+ public static function exists(string $lang): bool {
|
|
|
+ return in_array($lang, Minz_Translate::availableLanguages(), true);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Return the language to use in the application.
|
|
|
* It returns the connected language if it exists then returns the first match from the
|
|
|
@@ -95,6 +99,7 @@ class Minz_Translate {
|
|
|
*/
|
|
|
public static function getLanguage(?string $user, array $preferred, ?string $default): string {
|
|
|
if (null !== $user) {
|
|
|
+ if (!self::exists($user)) return 'en';
|
|
|
return $user;
|
|
|
}
|
|
|
|