diff options
author | Jonas Meurer <jonas@freesources.org> | 2022-01-10 12:01:12 +0100 |
---|---|---|
committer | Jonas Meurer <jonas@freesources.org> | 2022-01-10 13:06:23 +0100 |
commit | a6f0278e67287612357ed99ec423f36893871019 (patch) | |
tree | 99002c4028f0f2b6e007b998f6f450b858c09012 /lib | |
parent | 6572f801023f3b6bed33c32aee4edc5c8e840ece (diff) | |
download | nextcloud-server-a6f0278e67287612357ed99ec423f36893871019.tar.gz nextcloud-server-a6f0278e67287612357ed99ec423f36893871019.zip |
Default to language from request in L10N\Factory->getUserLanguage()
Try to get the language from request before falling back to the instance
default.
This fixes the detected user language during first login of a new user
and ensures that the returned language is consistent during the login.
Also partially fixes a bug with Collectives folder being initialized
in different languages at first login, see
https://gitlab.com/collectivecloud/collectives/-/issues/238
Signed-off-by: Jonas Meurer <jonas@freesources.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/L10N/Factory.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index a3ff7bf70e2..426ddf6c380 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -431,6 +431,15 @@ class Factory implements IFactory { if ($language !== null) { return $language; } + + // Use language from request + if ($this->userSession->getUser() instanceof IUser && + $user->getUID() === $this->userSession->getUser()->getUID()) { + try { + return $this->getLanguageFromRequest(); + } catch (LanguageNotFoundException $e) { + } + } } return $this->config->getSystemValue('default_language', 'en'); |