When checking if the module should perform a redirect, the RequestSubscriber uses this code:
$current_language = $this->languageManager->getCurrentLanguage();
However, this returns the interface language, which may be different than the content language. This effectively makes it impossible for admins to view content in another language.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | content_lang-3094823-1.patch | 1.1 KB | dabblela |
Comments
Comment #2
dabblela commentedComment #3
walkingdexter commentedHi, @dabblela!
I need more details to understand why the current implementation is not enough.
Comment #4
dabblela commentedThe use case is where the interface language is different than the content language. Example setup at /admin/config/regional/language/detection:
Interface text language detection:
Content language detection:
Then on the user edit page, set the Site language and/or Administration pages language to one language, enable and configure this module, and add a translation in a different language and try and view it.
Comment #5
walkingdexter commentedThe proposed resolution may affect backward compatibility. To avoid this, we can add a new setting to the Content Translation Redirect entity. If you write a patch faster than me, feel free to post it.
Comment #6
walkingdexter commentedComment #8
walkingdexter commented@dabblela, after many tests, I realized that your original solution is correct. Committed, thanks!