Do not limit Content language negotiation method to the current entity

Created on 29 May 2018, almost 7 years ago
Updated 30 January 2023, about 2 years ago

Problem/Motivation

A common use case is to be able keep a single interface language for an editor while he works with content in multiple languages.

Not being able to do that is especially annoying in a multi-domain setup, where the editor then has to log in again for every language domain.

Right now, that is surprisingly hard to achieve.

It seems like it should be possible through giving User/Session/Admin Language a higher priority than URL for the interface language and not for content. But there are several problems with that, related to the hidden/special URL language type ( 🐛 Language-specific aliases only work with url-based language negotiation Needs work ) and things like the route normalizer of the redirect.module (and eventually core: Route normalizer: Global Redirect in core Needs work ). So that's not possible and also doesn't really seem solvable.

The alternative is the "Content language" negotiation method that can be enabled for the content language type. That turns it around and instead adds a query argument to the URL that then enforces the content language. First tests show that it works fairly well but it is currently limited to altering outbound links only if the target entity is the "current entity". That means it works on node/1/translate, but it doesn't work on admin/content.

There also seem to be several bug reports about broken language switcher when that is enabled, so that will need to be fixed but is "just" a bug, while this is about a behavior change.

* 🐛 LanguageNegotiationContentEntity: don't break interface language switcher links Needs work
* 📌 LanguageNegotiationContentEntity: make language switch links more robust Needs work
* 🐛 Session and content entity switch links do not set the URL language Needs work

Proposed resolution

Update \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::meetsContentEntityRoutesCondition() and remove the current entity check?

IMHO that would make sense, based on how the default admin views now work (listing all translations, expecting that you can directly go to edit any of them).

I also found #2843439: Can't translate a content into a language different than that of the administration pages language setting as a possibly related issue, not quite sure how that affects things.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

10.1

Component
Language system 

Last updated 7 days ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

🇨🇭Switzerland berdir Switzerland

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Production build 0.71.5 2024