getTranslatedFieldFromEntity should use the content language

Created on 28 September 2020, almost 4 years ago
Updated 28 June 2023, about 1 year ago

Problem/Motivation

At the moment, the Block fetches the translated field from the entity using the getCurrentLanguage() function. The problem being that the default for this is the interface language. If you've defined a separate language for content, it won't work.

My use case being that the sites interface is always in English, but the content can be in many different languages.

Proposed resolution

There are two options I can see.

  • Always use the content language. This feels safe, the block is content after all.
  • Provide an option in the block management screen that asks if you want the content language or interface language.

I've provided a patch for option 1. It also adds the language to the cache contexts. This needs to be done regardless.

Remaining tasks

Decide on the approach to take
Commit.

User interface changes

Depends on approach

API changes

Depends on approach

Data model changes

Depends on approach

πŸ› Bug report
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand DanielVeza Brisbane, AU

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.

Production build 0.69.0 2024