When viewing content, field labels and field values should be in the same language

Created on 8 April 2021, over 3 years ago
Updated 30 May 2024, 3 months ago

Problem/Motivation

If a site has two different languages for content and interface, the interface language is always used for field labels, even for user-facing field labels on node view.

Steps to reproduce

  • Using the demo_umami profile, visit /admin/config/regional/language/detection.
  • Check the box to customize content language detection.
  • Choose any combination of settings such that you can visit a page with different content and interface languages; for example, choose "User" as the interface language detection method, and "URL" for the content language detection method.
  • View any translated content in a situation where content and interface languages are different; for example, in the above scenario, set your preferred language in your user profile to English, then visit /es/node/1 to view content in Spanish.
  • Observe that the field content is in Spanish but all the field labels are in English.

Proposed resolution

A straightforward fix for this issue is to change FormatterBase::view so that it explicitly fetches the field labels in the content language. There might be a more fundamental architectural problem here that could be fixed in a different way, and if so that would be great.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Language systemΒ  β†’

Last updated 1 day ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡ΊπŸ‡ΈUnited States ksenzee Seattle area

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.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    This came up as a daily triage issue for the bug smash initiative.

    Discussed this in #bugsmash and me and @quietone both agreed that this was the expected outcome when you choose a different content and interface language. So to us, this felt like "works as designed".

  • πŸ‡ΊπŸ‡ΈUnited States ksenzee Seattle area

    It may be "works as designed," but in that case, I am questioning the design. What is the practical use case for having labels be in the interface language? I can't think of one. I readily admit there may be one. But in my experience, both on my sites and answering questions in Slack, what people want out of the content/interface language split is "use interface language for admin and content language for end users." I'm curious what we're supposed to want out of the content/interface language split, if not that.

Production build 0.71.5 2024