Merge pull request #20993 from owncloud/issue-20666-language-always-overwritten

Do not overwrite the language when it's just missing for one app
This commit is contained in:
Thomas Müller 2015-12-07 16:19:21 +01:00
commit 663f31b127
1 changed files with 7 additions and 3 deletions

View File

@ -116,13 +116,17 @@ class OC_L10N implements \OCP\IL10N {
$preferred_language = str_replace('-', '_', $preferred_language); $preferred_language = str_replace('-', '_', $preferred_language);
foreach ($available as $available_language) { foreach ($available as $available_language) {
if ($preferred_language === strtolower($available_language)) { if ($preferred_language === strtolower($available_language)) {
if (!self::$language) {
self::$language = $available_language; self::$language = $available_language;
}
return $available_language; return $available_language;
} }
} }
foreach ($available as $available_language) { foreach ($available as $available_language) {
if (substr($preferred_language, 0, 2) === $available_language) { if (substr($preferred_language, 0, 2) === $available_language) {
if (!self::$language) {
self::$language = $available_language; self::$language = $available_language;
}
return $available_language; return $available_language;
} }
} }
@ -407,7 +411,7 @@ class OC_L10N implements \OCP\IL10N {
* If nothing works it returns 'en' * If nothing works it returns 'en'
*/ */
public static function findLanguage($app = null) { public static function findLanguage($app = null) {
if(self::$language != '') { if (self::$language != '' && self::languageExists($app, self::$language)) {
return self::$language; return self::$language;
} }