function LocaleConfigSubscriber::onConfigSave
Same name in other branches
- 9 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onConfigSave()
- 10 core/modules/locale/src/LocaleConfigSubscriber.php \Drupal\locale\LocaleConfigSubscriber::onConfigSave()
- 11.x 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 79
Class
- LocaleConfigSubscriber
- Updates strings translation when configuration translations change.
Namespace
Drupal\localeCode
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 (!InstallerKernel::installationAttempted() && !$this->localeConfigManager
->isUpdatingTranslationsFromLocale()) {
$config = $event->getConfig();
$langcode = $config->get('langcode') ?: 'en';
$this->updateLocaleStorage($config, $langcode);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.