diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php index ecd1167..147b9da 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -119,7 +119,7 @@ public function processOutbound($path, &$options = array(), Request $request = N // To avoid page cache duplicates, remove the language query if the default // language is set. - if (!$this->currentUser->id() && $cache && isset($options['query'][$this->queryParam]) && $options['query'][$this->queryParam] == $default) { + if ($this->currentUser->isAnonymous() && $cache && isset($options['query'][$this->queryParam]) && $options['query'][$this->queryParam] == $default) { unset($options['query'][$this->queryParam]); } @@ -148,8 +148,8 @@ public function getLanguageSwitchLinks(Request $request, $type, Url $url) { if ($langcode == $language_query) { $links[$langcode]['attributes']['class'][] = 'session-active'; } - // Always set the language query parameter. It will be removed if - // necessary in LanguageNegotiationSession::processOutbound(). + // Always set the language query parameter. It may be removed in + // LanguageNegotiationSession::processOutbound(). $links[$langcode]['query'][$param] = $langcode; }