Missing language_content_entity param in the /admin/content Entity label link and Operations links

Created on 18 October 2023, over 1 year ago

Problem/Motivation

When using the Content language detection > Content language plugin, the content admin page does not include the language_content_entity param which is quite confusing for the CMS users as they see the entity label translated but when they click on it, they are redirected to the original language node.

Steps to reproduce

  1. Enable Language and Content Translation modules
  2. Install Spanish language
  3. Access /admin/config/regional/language/detection
    1. Keep only "Selected language" in the "Interface text language"
    2. Check "Customize Content language detection to differ from Interface text language detection settings"
    3. Enable the "Content language"
    4. Uncheck the rest
  4. Access /admin/structure/types/manage/article
    1. Enable translation
  5. Create 2 articles, one for each language
  6. Access admin/content

Result: Notice that the entity label is translated however links don't include the language_content_entity query param and all link to node/{id}.

Proposed resolution

TBD

🐛 Bug report
Status

Active

Version

10.1

Component
Language system 

Last updated 7 days ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

🇧🇷Brazil carolpettirossi Campinas - SP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @carolpettirossi
  • 🇮🇳India deborahblessy

    Hi @carolpettirossi,

    I have installed Drupal 10, content translation and checked the mentioned issue. I couldn't reproduce the issue mentioned above. I have attached the screen recording below for reference. If any other issue, Please let me know.

  • 🇧🇷Brazil carolpettirossi Campinas - SP

    Hi @deborahblessy

    Can you please share a screenshot of the "Detection and Selection" page?

    It seems for the URLs you shared, that you kept the URL (Language from the URL - Path prefix or domain) enabled. The bug happens only if you don't have that enabled.

    See my config page below:

  • 🇩🇪Germany lukas_w

    I can confirm this issue and I have dug a little though the code to find the cause. The content entity language negotiator currently checks, if the path of the current request belongs to an entity and if the outbound path belongs to the same entity. Only in that case the language_content_entity query parameter is added to the outbound URL (i.e. the one used by the edit link).

    The admin content page does not belong to any entity and therefore the language_content_entity query parameter is not added to the edit links and the language used on the node edit page is the interface language.

    The deeper problem I see is that in processOutbound() the language negotiator cannot really determine, if it should do this or that, since it lacks the context the processed path is used in. The current behavior of the content entity language negotiator could be changed to also add language_content_entity, if the path is the edit-form link of an entity, but I would argue that this brings us only this far.

    I maintain a multilingual site, where the URL negotiator is used to determine the interface language. In the backend the interface language should not change when editing a node translation and for that I enabled the content entity negotiator and altered the edit links to add the language_content_entity query parameter. However, in the frontend there should be no difference between interface and content language, but on node pages, the language switcher sets language_content_entity instead of the URL language prefix.

    Maybe it would make sense for links (and Urls) to take a language_type option, that defines whether the provided language should be treated as interface or as content language. For the admin content page, the node edit links would use the content language type, whereupon the content entity negotiator would add the language_content_entity query parameter. For the language switcher in my frontend, it would use the interface type and the content entity negotiator would therefore ignore the provided language, leaving it for the URL negotiator to change the interface language.

    Would this be a viable solution?

Production build 0.71.5 2024