- Issue created by @bgreco
As a module author, I am having trouble writing a hook_update_N() function to rename the label of one of my config entities that works on sites where English is a non-default language.
Suppose my module provides a custom media type named "My media type", and I want to rename it to "Renamed media type" in a hook_update_N() function. According to Updating Configuration → , I would expect to write my update function like this:
function mymodule_update_10000() {
\Drupal::configFactory()
->getEditable('media.type.my_media_type')
->set('label', 'Renamed media type')
->save();
}
Expected result: the English config translation label gets changed to "Renamed media type". The Spanish config translation label does not change, because there's no Spanish translation for it in any .po file yet.
Actual result: The English config translation label remains "My media type". The Spanish config translation label is changed to "Renamed media type" (in English!).
\Drupal::configFactory()->getEditable('media.type.remote_video')->set('label', 'Remote video updated')->save();
What is the appropriate way for module authors to update their configuration in such a way that it works on all sites, regardless of the default language?
Active
10.5 ✨
config_translation.module