Use langcode for 'content language' not 'interface language'

Created on 3 July 2018, over 6 years ago
Updated 24 July 2024, 3 months ago

This relates to the way core's language manager is setup - LanguageManager::getCurrentLanguage($type) uses a default value LanguageInterface::TYPE_INTERFACE for $type. This is a problem if the interface and content languages are configured to be negotiated separately - e.g. retain interface in site default language (e.g. English) even if content is shown in a translation language.

It could be argued that we should probably default to use the negotiated content language when translating site settings entities (e.g. when replacing site settings tokens, or rendering in twig templates) - assuming that they are being rendered on 'content' pages (vs admin pages). Is that a correct assumption, at least for the majority of use cases? Are developers placing site_settings entities on mostly content or mostly admin pages?

The attached patch defaults to use the content langcode.

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇨🇦Canada bgilhome Victoria

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.71.5 2024