- Issue created by @geek-merlin
(Re-reading this, i do not see the relation to entity labels. The difffering ConfitOverrideLanguage is correct thouth.)
Note that there are other issue which lead to the same outcome (wrong entity labels), but have different reasons.
Long story short, we found situations where CurrentLanguage is negotiated, but NOT yet copied to ConfigOverrideLanguage. That should not be.
It's some time ago, but here's the note i made in that MultiLangNG commit:
/**
* Get configuration target language.
*
* This should in fact use LanguageManagerInterface::getConfigOverrideLanguage,
* but this leads to nasty and hard debug issues. How to reproduce:
* - Set 'de' as negotiation default.
* - (Maybe it's relevant to enable search_api and webform_views)
* Then on `drush cr`, english labels are cached for 'de'.
* This is because EntityTypeManager caches field definitions for
* currentLanguage, which is "de", but configOverrideLanguage is "en",
* because it defaults to defaultLanguage and seems to not have been set yet.
*
* Maybe the reason is that sometimes the listener calls currentLanguage
* before it's initialized, in which case it falls back to 'system', but
* later when it is initialized, configOverrideLanguage is not updated.
* If that is the case, finishing initialization of LanguageManager should
* trigger syncing configOverrideLanguage somehow.
*
* And in the end, do we need configOverrideLanguage as a separate concept
* from currentLanguage (i.e. interface_language) at all?
*
* @see \Drupal\Core\Language\LanguageManagerInterface::getConfigOverrideLanguage
* @see \Drupal\language\EventSubscriber\LanguageRequestSubscriber::setLanguageOverrides
* @see \Drupal\language\ConfigurableLanguageManager::getCurrentLanguage
*
* @todo Find a fix upstream and get rid of this hack.
*/
protected function getTargetLanguage(): LanguageInterface {
- return $this->getLanguageManager()->getConfigOverrideLanguage();
+ return $this->getLanguageManager()->getCurrentLanguage();
Change the copy-over logic in a way that avoids the diverging situation.
Think, code, review, commit
None
TBD
TBD
TBD
Active
10.1 ✨