aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-10-08 15:40:40 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-10-08 15:40:40 +0200
commit5a05af05db89c1698892c640ccb6852019d432ee (patch)
tree52e455507e372023c6d64abda31dc6d9d4a64e94 /lib
parent1b8949ebac94339a359e159afe1480214a3b9746 (diff)
downloadnextcloud-server-5a05af05db89c1698892c640ccb6852019d432ee.tar.gz
nextcloud-server-5a05af05db89c1698892c640ccb6852019d432ee.zip
feat(l10n): Respect forceLanguage query parameter in more placesfeat/add-query-param-to-force-language
Attempt to make L10N Factory consistent with itself when forceLanguage query parameter is used. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/L10N/Factory.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index dc65714c11b..eb84f264f5f 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -139,7 +139,7 @@ class Factory implements IFactory {
*/
public function findLanguage(?string $appId = null): string {
// Step 1: Forced language always has precedence over anything else
- $forceLang = $this->config->getSystemValue('force_language', false);
+ $forceLang = $this->request->getParam('forceLanguage') ?? $this->config->getSystemValue('force_language', false);
if (is_string($forceLang)) {
$this->requestLanguage = $forceLang;
}
@@ -196,7 +196,7 @@ class Factory implements IFactory {
public function findGenericLanguage(?string $appId = null): string {
// Step 1: Forced language always has precedence over anything else
- $forcedLanguage = $this->config->getSystemValue('force_language', false);
+ $forcedLanguage = $this->request->getParam('forceLanguage') ?? $this->config->getSystemValue('force_language', false);
if ($forcedLanguage !== false) {
return $forcedLanguage;
}
@@ -411,6 +411,10 @@ class Factory implements IFactory {
return $language;
}
+ if (($forcedLanguage = $this->request->getParam('forceLanguage')) !== null) {
+ return $forcedLanguage;
+ }
+
// Use language from request
if ($this->userSession->getUser() instanceof IUser &&
$user->getUID() === $this->userSession->getUser()->getUID()) {
@@ -421,7 +425,7 @@ class Factory implements IFactory {
}
}
- return $this->config->getSystemValueString('default_language', 'en');
+ return $this->request->getParam('forceLanguage') ?? $this->config->getSystemValueString('default_language', 'en');
}
/**