From f7f9ef55b6b6129113f0de1e3589e1ed1f9850a7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 4 May 2016 08:28:13 +0200 Subject: [PATCH] Do not save the language as request lang for apps when we didn't find any --- lib/private/l10n/factory.php | 2 +- tests/lib/l10n/factorytest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index 8f157d9c0b..08b92657a1 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 e4c0eab2e6..98bb5ec13c 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', ''], ]; }