aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-05-04 13:47:08 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-05-04 13:47:08 +0200
commit873849e8436b9a502038742ed7c1744e7954082b (patch)
tree2da1de188f60bfb84eed742498ce91bcd4b71099
parent61be98f554d83de3fbd76ce0772c48cb95ec1327 (diff)
parent9fbb8ce302bdc06621c7f22d09b3a672758b34cd (diff)
downloadnextcloud-server-873849e8436b9a502038742ed7c1744e7954082b.tar.gz
nextcloud-server-873849e8436b9a502038742ed7c1744e7954082b.zip
Merge pull request #24432 from owncloud/issue-24270-never-save-app-language-into-request-lang
Do not save the language as request lang for apps when we didn't find…
-rw-r--r--lib/private/L10N/Factory.php2
-rw-r--r--tests/lib/l10n/factorytest.php9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index 8f157d9c0bb..08b92657a1b 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -263,7 +263,7 @@ class Factory implements IFactory {
}
}
- if (!$this->requestLanguage) {
+ if ($app === null && !$this->requestLanguage) {
$this->requestLanguage = 'en';
}
return 'en'; // Last try: English
diff --git a/tests/lib/l10n/factorytest.php b/tests/lib/l10n/factorytest.php
index e4c0eab2e6a..98bb5ec13c9 100644
--- a/tests/lib/l10n/factorytest.php
+++ b/tests/lib/l10n/factorytest.php
@@ -343,6 +343,15 @@ class FactoryTest extends TestCase {
[null, 'de', 'ru', ['de'], 'de', 'ru'],
[null, 'de,en', 'ru', ['de'], 'de', 'ru'],
[null, 'de-DE,en-US;q=0.8,en;q=0.6', 'ru', ['de'], 'de', 'ru'],
+
+ // Request lang should not be set for apps: Language is available
+ ['files_pdfviewer', 'de', null, ['de'], 'de', ''],
+ ['files_pdfviewer', 'de,en', null, ['de'], 'de', ''],
+ ['files_pdfviewer', 'de-DE,en-US;q=0.8,en;q=0.6', null, ['de'], 'de', ''],
+ // Request lang should not be set for apps: Language is not available
+ ['files_pdfviewer', 'de', null, ['ru'], 'en', ''],
+ ['files_pdfviewer', 'de,en', null, ['ru', 'en'], 'en', ''],
+ ['files_pdfviewer', 'de-DE,en-US;q=0.8,en;q=0.6', null, ['ru', 'en'], 'en', ''],
];
}