diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-06-26 17:25:37 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-06-29 09:11:04 +0200 |
commit | 25d9c3e52921b107383e5d05f3649178bd7cd1cf (patch) | |
tree | 837fb580784174aa14a1d412056b1e9bf4f61772 /lib/private/L10N/Factory.php | |
parent | 4ed8ee1c1e8ada0e5d26f6e014896accc89d4d6a (diff) | |
download | nextcloud-server-25d9c3e52921b107383e5d05f3649178bd7cd1cf.tar.gz nextcloud-server-25d9c3e52921b107383e5d05f3649178bd7cd1cf.zip |
adjust backend and gui to update and changelog server
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/L10N/Factory.php')
-rw-r--r-- | lib/private/L10N/Factory.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 8c8735836bb..79495f5ff88 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -32,6 +32,7 @@ namespace OC\L10N; use OCP\IConfig; use OCP\IRequest; +use OCP\IUser; use OCP\IUserSession; use OCP\L10N\IFactory; @@ -321,6 +322,37 @@ class Factory implements IFactory { return array_search($lang, $languages) !== false; } + public function iterateLanguage(bool $reset = false): string { + static $i = 0; + if($reset) { + $i = 0; + } + switch($i) { + /** @noinspection PhpMissingBreakStatementInspection */ + case 0: + $i++; + $forcedLang = $this->config->getSystemValue('force_language', false); + if(is_string($forcedLang)) { + return $forcedLang; + } + /** @noinspection PhpMissingBreakStatementInspection */ + case 1: + $i++; + $user = $this->userSession->getUser(); + if($user instanceof IUser) { + $userLang = $this->config->getUserValue($user->getUID(), 'core', 'lang', null); + if(is_string($userLang)) { + return $userLang; + } + } + case 2: + $i++; + return $this->config->getSystemValue('default_language', 'en'); + default: + return 'en'; + } + } + /** * @param string $locale * @return bool |