From 70396581eb4c33b380962d4589ce183f01dfc090 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 18 Jan 2016 09:53:25 +0100 Subject: Add tests for findLanguage() --- lib/private/l10n/factory.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/private') diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index 40ad4f5ef59..09496cba410 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -109,22 +109,22 @@ class Factory implements IFactory { $userId = \OC_User::getUser(); // FIXME not available in non-static? - if ($userId && $this->config->getUserValue($userId, 'core', 'lang')) { - $lang = $this->config->getUserValue($userId, 'core', 'lang'); - $this->requestLanguage = $lang; - if ($this->languageExists($app, $lang)) { - return $lang; + $userLang = $userId !== false ? $this->config->getUserValue($userId, 'core', 'lang') : null; + if ($userLang) { + $this->requestLanguage = $userLang; + if ($this->languageExists($app, $userLang)) { + return $userLang; } } $defaultLanguage = $this->config->getSystemValue('default_language', false); - if ($defaultLanguage !== false) { + if ($defaultLanguage !== false && $this->languageExists($app, $defaultLanguage)) { return $defaultLanguage; } $lang = $this->setLanguageFromRequest($app); - if ($userId && $app === null && !$this->config->getUserValue($userId, 'core', 'lang')) { + if ($userId !== false && $app === null && !$userLang) { $this->config->setUserValue($userId, 'core', 'lang', $lang); } -- cgit v1.2.3