diff --git a/core/modules/locale/src/LocaleConfigSubscriber.php b/core/modules/locale/src/LocaleConfigSubscriber.php index d06cb34dec..f2eef74fde 100644 --- a/core/modules/locale/src/LocaleConfigSubscriber.php +++ b/core/modules/locale/src/LocaleConfigSubscriber.php @@ -76,10 +76,16 @@ public static function getSubscribedEvents() { * The configuration event. */ public function onConfigSave(ConfigCrudEvent $event) { + // Do not feed back configuration translation changes during installation + // because configuration translation has not taken place yet. The one + // exception is the system.site configuration object because the user + // provides a custom translation of the site name during installation. + $config = $event->getConfig(); + $is_installing = drupal_installation_attempted() && $config->getName() !== 'system.site'; + // Only attempt to feed back configuration translation changes to locale if // the update itself was not initiated by locale data changes. - if (!drupal_installation_attempted() && !$this->localeConfigManager->isUpdatingTranslationsFromLocale()) { - $config = $event->getConfig(); + if (!$is_installing && !$this->localeConfigManager->isUpdatingTranslationsFromLocale()) { $langcode = $config->get('langcode') ?: 'en'; $this->updateLocaleStorage($config, $langcode); } diff --git a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php index e52b0469bb..3d2c4c44ab 100644 --- a/core/modules/system/src/Tests/Installer/DistributionProfileTest.php +++ b/core/modules/system/src/Tests/Installer/DistributionProfileTest.php @@ -46,6 +46,8 @@ protected function setUp() { protected function setUpLanguage() { // Verify that the distribution name appears. $this->assertRaw($this->info['distribution']['name']); + // Verify that the distribution name is used in the site title. + $this->assertTitle('Choose language | ' . $this->info['distribution']['name']); // Verify that the requested theme is used. $this->assertRaw($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index a608cada77..dcde753d76 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -51,13 +51,29 @@ protected function getPo($langcode) { msgid "Language" msgstr "Language $langcode" + +#: Testing site name configuration during the installer. +msgid "Drupal" +msgstr "Drupal" ENDPO; } + /** + * {@inheritdoc} + */ + protected function installParameters() { + $params = parent::installParameters(); + $params['forms']['install_configure_form']['site_name'] = 'SITE_NAME_' . $this->langcode; + return $params; + } + /** * Tests that translations ended up at the expected places. */ public function testTranslationsLoaded() { + // Ensure the title is correct. + $this->assertEqual('SITE_NAME_' . $this->langcode, \Drupal::config('system.site')->get('name')); + // Verify German and Spanish were configured. $this->drupalGet('admin/config/regional/language'); $this->assertText('German');