From c6dbe8ac63eb4db135b045ca0dcec1dd5f3b4cbc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 7 Dec 2015 14:34:15 +0100 Subject: [PATCH] Do not overwrite the language when it's just missing for one app --- lib/private/l10n.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 86335bce92..7835285bd4 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -116,13 +116,17 @@ class OC_L10N implements \OCP\IL10N { $preferred_language = str_replace('-', '_', $preferred_language); foreach ($available as $available_language) { if ($preferred_language === strtolower($available_language)) { - self::$language = $available_language; + if (!self::$language) { + self::$language = $available_language; + } return $available_language; } } foreach ($available as $available_language) { if (substr($preferred_language, 0, 2) === $available_language) { - self::$language = $available_language; + if (!self::$language) { + self::$language = $available_language; + } return $available_language; } } @@ -407,7 +411,7 @@ class OC_L10N implements \OCP\IL10N { * If nothing works it returns 'en' */ public static function findLanguage($app = null) { - if(self::$language != '') { + if (self::$language != '' && self::languageExists($app, self::$language)) { return self::$language; }