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.

CommentFileSizeAuthor
#2 content_lang-3094823-1.patch1.1 KBdabblela

Comments

dabblela created an issue. See original summary.

dabblela’s picture

StatusFileSize
new1.1 KB
walkingdexter’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hi, @dabblela!

I need more details to understand why the current implementation is not enough.

dabblela’s picture

The 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:

  • Account administration pages
  • User
  • URL

Content language detection:

  • URL

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.

walkingdexter’s picture

Status: Postponed (maintainer needs more info) » Active

The 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.

walkingdexter’s picture

Category: Bug report » Feature request

  • WalkingDexter committed 5fa7b66 on 8.x-1.x authored by dabblela
    Issue #3094823 by dabblela, WalkingDexter: Request subscriber should use...
walkingdexter’s picture

Category: Feature request » Bug report
Status: Active » Fixed

@dabblela, after many tests, I realized that your original solution is correct. Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.