You are here

protected function LocaleConfigSubscriber::updateLocaleStorage in Drupal 8

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

Update locale storage based on configuration translations.

Parameters

\Drupal\Core\Config\StorableConfigBase $config: Active configuration or configuration translation override.

string $langcode: The language code of $config.

array $reference_config: (Optional) Reference configuration to check against if $config was an override. This allows us to update locale keys for data not in the override but still in the active configuration.

2 calls to LocaleConfigSubscriber::updateLocaleStorage()
LocaleConfigSubscriber::onConfigSave in core/modules/locale/src/LocaleConfigSubscriber.php
Updates the locale strings when a translated active configuration is saved.
LocaleConfigSubscriber::onOverrideChange in core/modules/locale/src/LocaleConfigSubscriber.php
Updates the locale strings when a configuration override is saved/deleted.

File

core/modules/locale/src/LocaleConfigSubscriber.php, line 118

Class

LocaleConfigSubscriber
Updates strings translation when configuration translations change.

Namespace

Drupal\locale

Code

protected function updateLocaleStorage(StorableConfigBase $config, $langcode, array $reference_config = []) {
  $name = $config
    ->getName();
  if ($this->localeConfigManager
    ->isSupported($name) && locale_is_translatable($langcode)) {
    $translatables = $this->localeConfigManager
      ->getTranslatableDefaultConfig($name);
    $this
      ->processTranslatableData($name, $config
      ->get(), $translatables, $langcode, $reference_config);
  }
}