Problem/Motivation
I am trying to get (and perhaps even set) the translation of a configuration entity. I do not know how, the ConfigFactory doesn't have anything where I could set a language, no method, no argument, nothing. The ConfigFactoryInterface is not implemented by any other class. All the information provided by https://www.drupal.org/node/1928898 points to nonexisting things: setLanguage method on ConfigFactory, language.config. prefix objects (I am pretty sure that's just language. prefix because of what I see in LanguageConfigCollectionNameTrait ). #2219499: Generalize language config override responsibility removed setLanguage from ConfigFactory almost two years ago and left no change record behind. It has this to say in API changes "Active language for configuration is now set on the LanguageManager".
Proposed resolution
Is LanguageManagerInterface::setConfigOverrideLanguage the one to call, then?
- Fix https://www.drupal.org/node/1928898
- Add at least a @link to that handbook page but also if possible a code sample in ConfigFactory::get would be nice
Comments
Comment #2
chx CreditAttribution: chx at Smartsheet commentedComment #3
dawehnerConfig translation is using primarily the interface
\Drupal\Core\Config\ConfigFactoryOverrideInterface
, which has asetLanguage
method, which is called from
\Drupal\language\ConfigurableLanguageManager::setConfigOverrideLanguage
Comment #4
Gábor Hojtsyhttps://api.drupal.org/api/drupal/core%21modules%21user%21user.module/fu... is the current code, the docs page is indeed outdated.
Comment #5
Gábor HojtsyComment #7
Kristen PolComment #17
larowlanComment #20
sleitner CreditAttribution: sleitner commentedhttps://www.drupal.org/node/1928898/#s-language-overrides was updated to explain how language overrides work.