summaryrefslogtreecommitdiffstats
path: root/lib/private/l10n
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-01-18 09:53:25 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-01-26 14:02:32 +0100
commit70396581eb4c33b380962d4589ce183f01dfc090 (patch)
treee44d93cdcea7080d858316ca8126ce95f49b782c /lib/private/l10n
parentfe411788b7ee45e2da551fd20aded030b762eecc (diff)
downloadnextcloud-server-70396581eb4c33b380962d4589ce183f01dfc090.tar.gz
nextcloud-server-70396581eb4c33b380962d4589ce183f01dfc090.zip
Add tests for findLanguage()
Diffstat (limited to 'lib/private/l10n')
-rw-r--r--lib/private/l10n/factory.php14
1 files changed, 7 insertions, 7 deletions
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);
}