Problem/Motivation

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.

Proposed resolution

Test whether changes are needed. Apply https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

Remaining tasks

When changes are needed, let's fix. Should we add test-coverage?

User interface changes

API changes

Data model changes

Command icon 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

fago created an issue. See original summary.

fago’s picture

Issue summary: View changes
mostepaniukvm’s picture

fago’s picture

Status: Active » Needs work

This 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.

mostepaniukvm’s picture

Status: Needs work » Needs review

Yes, totally make sense. I added optional $langcode parameter same as in EntityViewBuilder::view()
Tested, works well locally

fago’s picture

Status: Needs review » Reviewed & tested by the community

great, this seems really straight forward now!

  • mostepaniukvm committed 938c4f0 on 8.x-2.x
    Issue #3278992 by mostepaniukvm, fago: Ensure entity rendering applies...
mostepaniukvm’s picture

Status: Reviewed & tested by the community » Fixed

Merged, will include in next patch release

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.