Problem/Motivation
Child of #3615902: Plan: Translation support. The builder decides which translation it edits from the URL language: Instance::ensureCurrentTranslation() and DisplayBuildablePluginBase::getTranslationLangcode() read LanguageInterface::TYPE_URL, not core's configurable negotiation. pdureau challenged it in #3555110: Symmetric translation #63.
Three other checks read the interface language: the 404 guard of IntegrationControllerBase, EntityViewOverride::checkAccess() and LanguageSwitcher. They agree while the interface language follows the URL prefix, and differ when a site negotiates it another way: session, user preference, browser.
Proposed resolution
Decide one rule, and apply it to the five places:
- The URL language, as today: the builder edits the translation of the URL, whatever the admin interface is in. The three checks follow.
- Or core's negotiation, with a documented setting for sites whose interface language is not the edited one.
Kernel tests for a site negotiating the interface language by session.
Remaining tasks
- Decide the rule.
User interface changes
Depends on the rule.
API changes
None expected. #3624396: Plan: Harden InstanceInterface, IslandInterface and DisplayBuildableInterface as public API before RC1 child 3a only fixes the contract of ensureCurrentTranslation().
Data model changes
None.
Issue fork display_builder-3627287
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mogtofu33 commentedComment #3
pdureau commentedLet's try to stay close to Core, instead of having our own hardcoded mechanism. Especially if it simplifies our implementation.
We may need to be aware of
LanguageInterface::TYPE_CONTENTwhich is is resolved, directly or indirectly (sometimes usingLanguageInterface::TYPE_INTERFACEas proxy) instead ofLanguageInterface::TYPE_URL.It must be done with minimal changes of phpunit tests, and without any change of playwright tests, because the current mechanism is just a specific case (URL detection) of the Core Language Detection API.
However, let's be careful. According to Christian, if my understanding is right, this hardcoded mechanism is related to the automatic creation of config translations, something we would want to keep.
It can also be the opportunity to challenge
InstanceTranslationSubscriber.I will give a try now but this change is not mandatory for 1.0.0, so I may remove the
1.0.0-betatag after my try.Comment #5
pdureau commentedA proposal from Claude Code: https://git.drupalcode.org/project/display_builder/-/merge_request/508
The diff is
+ 340 − 83but it is only+ 60 − 42insrc/folders, and it adds only 8 lines of PHP code.Feedback from LLM:
We have 2 plawright fails:
So I move this task out of 1.0.0 scope, until someone want to take it.
Once Playwright is OK, we will need to do manual tests to be 100% sure, the same steps as "Page Layout" there: https://www.drupal.org/project/display_builder/issues/3555110#comment-16...
Comment #6
mogtofu33 commentedComment #7
mogtofu33 commentedComment #8
mogtofu33 commentedComment #9
mogtofu33 commentedAs said in #3627287-5: Decide which language the builder edits: the URL one, or core's negotiated one, moving to the content language changes which translation editors land on, so it waits until after 1.0. Removing the RC blocker tag.
Until then the URL language stays the rule. Three checks still read the interface language: the 404 guard in
IntegrationControllerBase::renderBuilder(),EntityViewOverride::access()andLanguageSwitcher.I will open a bug to align them, it can land during RC.
Comment #10
mogtofu33 commented