public function LocaleConfigSubscriber::onOverrideChange in Drupal 9
Same name and namespace in other branches
- 8 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onOverrideChange()
Updates the locale strings when a configuration override is saved/deleted.
Parameters
\Drupal\language\Config\LanguageConfigOverrideCrudEvent $event: The language configuration event.
File
- core/
modules/ locale/ src/ LocaleConfigSubscriber.php, line 95
Class
- LocaleConfigSubscriber
- Updates strings translation when configuration translations change.
Namespace
Drupal\localeCode
public function onOverrideChange(LanguageConfigOverrideCrudEvent $event) {
// Only attempt to feed back configuration override changes to locale if
// the update itself was not initiated by locale data changes.
if (!InstallerKernel::installationAttempted() && !$this->localeConfigManager
->isUpdatingTranslationsFromLocale()) {
$translation_config = $event
->getLanguageConfigOverride();
$langcode = $translation_config
->getLangcode();
$reference_config = $this->configFactory
->getEditable($translation_config
->getName())
->get();
$this
->updateLocaleStorage($translation_config, $langcode, $reference_config);
}
}