function LocaleConfigSubscriber::onOverrideChange

Same name in other branches
  1. 9 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onOverrideChange()
  2. 10 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onOverrideChange()
  3. 11.x 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\locale

Code

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.