Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295555

Doubts about Content language negotiation

$
0
0

Hi,

I have some doubts about Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity.
I am posting them here, but I can open sub-issues if appropriate.

I enable the Content language negotiation mechanism in /admin/config/regional/language/detection by checking the "Customize Content language detection" box, and enabling the "Content language" negotiator.

When Content language negotiation is enabled I would expect to be able to change the interface language and the content language independently one from the other, but this does not always work.

I also tried to use the two separate blocks: "Language switcher (Interface text)" and "Language switcher (Content)", and I noticed some inconsistencies.

Outbound paths

For example on the front page, links to entities are not processed by LanguageNegotiationContentEntity::processOutbound() (i.e. the query string for the content translation does not get added, I'd assume the default would be to keep the current content language).

By looking at the code it looks like this can be solved by relaxing the assumptions made in LanguageNegotiationContentEntity::meetsContentEntityRoutesCondition(), right now the condition is:

  1. URL points to an entity;
  2. AND it refers to the current request.

Why can't we just check for the first condition to decide whether or not to process an outbound path?
See #2863465: LanguageNegotiationContentEntity: make links to entities only change the content language.

Language switcher links

Another doubt I have is about LanguageNegotiationContentEntity::getLanguageSwitchLinks(), it looks like this gets never called.
[...]

EDIT: I figured out that I am supposed to use the "Language switcher (Content)" block to switch the content, and not the other one, so I am dropping this part and the last paragraph below, but the other doubts still hold.

Inconsistencies of Language switcher (Interface text)

When "Content language" negotiation is enabled, the "Language switcher (Interface text)" block behaves like this:

  • on the front page it switches the interface language,
  • after visiting an entity path the first time (i.e. no query string in the URL) it only allows to switch the content language (maybe because of processOutbound()?).
  • it breaks completely after actually switching the content language of the entity.

Maybe the Language Switcher should always and only deal with the Interface language, and other means should be used to switch the content language? Like a different Language switcher block or some field on the lines of Entity Translation Switcher.

Thanks,
Antonio


Viewing all articles
Browse latest Browse all 295555


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>