You are here

public function LocaleConfigSubscriber::onConfigSave in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onConfigSave()

Updates the locale strings when a translated active configuration is saved.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.

File

core/modules/locale/src/LocaleConfigSubscriber.php, line 82
Contains \Drupal\locale\LocaleConfigSubscriber.

Class

LocaleConfigSubscriber
Updates strings translation when configuration translations change.

Namespace

Drupal\locale

Code

public function onConfigSave(ConfigCrudEvent $event) {

  // Only attempt to feed back configuration translation changes to locale if
  // the update itself was not initiated by locale data changes.
  if (!drupal_installation_attempted() && !$this->localeConfigManager
    ->isUpdatingTranslationsFromLocale()) {
    $config = $event
      ->getConfig();
    $langcode = $config
      ->get('langcode') ?: 'en';
    $this
      ->updateLocaleStorage($config, $langcode);
  }
}