Skip to content

Commit

Permalink
Don't override URL uselang parameter (#67)
Browse files Browse the repository at this point in the history
Only use the session's `lang` parameter if the query string's
`uselang` parameter is not set.

Bug: T357821
  • Loading branch information
samwilson committed Feb 19, 2024
1 parent 5175962 commit 4b4a600
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Service/Intuition.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function serviceFactory(
if ($currentRequest->hasSession()) {
$session = $currentRequest->getSession();
$sessionLang = $session->get('lang');
if (!empty($sessionLang)) {
if (!$queryLang && !empty($sessionLang)) {
$useLang = $sessionLang;
}
// Save the language to the session.
Expand All @@ -50,7 +50,7 @@ public static function serviceFactory(
}

// Set up Intuition, using the selected language.
$intuition = new static(['domain' => $domain]);
$intuition = new static(['domain' => $domain, 'param' => false]);
$intuition->registerDomain($domain, $projectDir.'/i18n');
$intuition->registerDomain('toolforge', dirname(__DIR__).'/Resources/i18n');
$intuition->setLang(strtolower($useLang));
Expand Down

0 comments on commit 4b4a600

Please sign in to comment.