Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LocaleConfigSubscriber.php

function 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 86

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 (!InstallerKernel::installationAttempted() && !$this->localeConfigManager
        ->isUpdatingTranslationsFromLocale()) {
        $config = $event->getConfig();
        $langcode = $config->get('langcode') ?: 'en';
        $this->updateLocaleStorage($config, $langcode);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal