From a6f0278e67287612357ed99ec423f36893871019 Mon Sep 17 00:00:00 2001 From: Jonas Meurer Date: Mon, 10 Jan 2022 12:01:12 +0100 Subject: 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 --- lib/private/L10N/Factory.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/private/L10N') 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'); -- cgit v1.2.3