Closed (fixed)
Project:
Custom Elements
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 May 2022 at 12:35 UTC
Updated:
19 Aug 2022 at 14:19 UTC
Jump to comment: Most recent
When having a multi-language site, let's make sure the module correctly applies the active language, i.e. it renders the right entity translation and falls back according to the site-wide language fallback rules.
Test whether changes are needed. Apply https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
When changes are needed, let's fix. Should we add test-coverage?
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
fagoComment #3
mostepaniukvmComment #5
fagoThis seems like a simple and good fix. But we should have the api to render $entity in a desired translation available - how woudl we do this if this always uses the content-language?
I looked up https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21... and I think it provides the solution - simply add an optional $langcode parameter?
> string $langcode: (optional) For which language the entity should be rendered, defaults to the current content language.
Comment #6
mostepaniukvmYes, totally make sense. I added optional
$langcodeparameter same as inEntityViewBuilder::view()Tested, works well locally
Comment #7
fagogreat, this seems really straight forward now!
Comment #9
mostepaniukvmMerged, will include in next patch release