Fix ConfigurationLanguage deviating from InterfaceLanguage by setting it instantly

Created on 24 October 2025, 8 days ago

Problem/Motivation

Coming from #3446084-26: EntityTypeBundleInfo static caching is not language aware .
Developers have the expectation that ConfigOverrideLanguage is InterfaceLanguage.
Currently that is not the case for a quite long time in the request, because (quoting from #3446084-26: EntityTypeBundleInfo static caching is not language aware ):

The MR fixes the case i mentioned above, great work! Unfortunately i do not have access to the codebase that this problem originally occured in but i can still reproduce the issue in Drupal 11.2 with 2+ languages.
To reproduce it, do the following steps:
1. Create a KernelEvents::REQUEST subscriber with a priority higher than 255 (Higher than LanguageRequestSubscriber) that calls EntityTypeBundleInfoInterface::getAllBundleInfo().

With core only:
2. Create a controller that just calls drupal_flush_all_caches(), then returns.
3. Visit the controller in another language than English, lets say Swedish.

With admin toolbar:
2. "Admin toolbar" -> "Flush all caches" in a non English language, lets say Swedish.

Now the English bundle labels are cached under the Swedish cache key. So in short, the bug occurs when calling EntityTypeBundleInfoInterface::getAllBundleInfo() before LanguageRequestSubscriber::onKernelRequestLanguage() directly after a cache rebuild in another language than English. I do not have time to narrow down the reproduction steps further than this, but it can be used to recreate my original issue.

Proposed resolution

Find a way to set ConfigurationLanguage to InterfaceLanguage instantly

Remaining tasks

- Write a test from the above
- Find a way to fix the problem

API changes

Maybe.

Data model changes

None expected.

Release notes snippet

Config language is now always in sync w/ interface language.

📌 Task
Status

Active

Version

11.0 🔥

Component

language system

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

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.

No activities found.

Production build 0.71.5 2024