- 🇮🇳India namisha jadhav
Re-roll of #13. Compatible with Redirect module version 8.x-1.11.
Context:
In my project, I force interface language to be always the same ; it helps content manager to get the interface in a language they know (sometimes they have to fix few things in a language they don't know so it helps).
Problem:
If interface language (let's say English) and content language (let's say Chinese) don't match, if there is a redirection for the current URL (in Chinese), it won't match anything in the DB since it searches for a match in the DB with interface language (English).
In "src/EventSubscriber/RedirectRequestSubscriber.php" at line 137 we have :
$redirect = $this->redirectRepository->findMatchingRedirect($path, $request_query, $this->languageManager->getCurrentLanguage()->getId());
and "getCurrentLanguage" code is :
public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE)
so it takes interface language and there is no match.
Solution:
Use "getCurrentLanguage" with "LanguageInterface::TYPE_CONTENT" as param.
Questions:
Any impact? Or is there any reason to use the interface language?
Needs work
1.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Re-roll of #13. Compatible with Redirect module version 8.x-1.11.