function LocaleConfigSubscriber::updateLocaleStorage

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

Class

LocaleConfigSubscriber
Updates strings translation when configuration translations change.

Namespace

Drupal\locale

Code

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

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