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

Breadcrumb

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

function LocaleConfigSubscriber::onOverrideChange

Updates the locale strings when a configuration override is saved/deleted.

Parameters

\Drupal\language\Config\LanguageConfigOverrideCrudEvent $event: The language configuration event.

File

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

Class

LocaleConfigSubscriber
Updates strings translation when configuration translations change.

Namespace

Drupal\locale

Code

public function onOverrideChange(LanguageConfigOverrideCrudEvent $event) {
    // Only attempt to feed back configuration override changes to locale if
    // the update itself was not initiated by locale data changes.
    if (!InstallerKernel::installationAttempted() && !$this->localeConfigManager
        ->isUpdatingTranslationsFromLocale()) {
        $translation_config = $event->getLanguageConfigOverride();
        $langcode = $translation_config->getLangcode();
        $reference_config = $this->configFactory
            ->getEditable($translation_config->getName())
            ->get();
        $this->updateLocaleStorage($translation_config, $langcode, $reference_config);
    }
}

API Navigation

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