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:
commit
663f31b127
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue