diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 7e33986..85a4da0 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1668,7 +1668,10 @@ function install_download_additional_translations_operations(&$install_state) { // If a non-English language was selected, change the default language and // remove English. if ($langcode != 'en') { - \Drupal::configFactory()->getEditable('system.site')->set('langcode', $langcode)->save(); + \Drupal::configFactory()->getEditable('system.site') + ->set('langcode', $langcode) + ->set('default_langcode', $langcode) + ->save(); \Drupal::service('language.default')->set($language); if (empty($install_state['profile_info']['keep_english'])) { entity_delete_multiple('configurable_language', array('en')); diff --git a/core/includes/install.inc b/core/includes/install.inc index e247378..61d286b 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -620,6 +620,7 @@ function drupal_install_system($install_state) { if (isset($install_state['parameters']['langcode'])) { \Drupal::configFactory()->getEditable('system.site') ->set('langcode', $install_state['parameters']['langcode']) + ->set('default_langcode', $install_state['parameters']['langcode']) ->save(); } } diff --git a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php index 44c14f1..5790294 100644 --- a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php +++ b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php @@ -145,7 +145,7 @@ function testPerUserLoginFloodControl() { */ function testLocale() { ConfigurableLanguage::createFromLangcode('de')->save(); - $this->config('system.site')->set('langcode', 'de')->save(); + $this->config('system.site')->set('default_langcode', 'de')->save(); $account = $this->drupalCreateUser(); $url = Url::fromRoute('router_test.11'); diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php index ab303b6..279b56f 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php @@ -406,7 +406,7 @@ function testJSTranslation() { protected function assertCKEditorLanguage($langcode = 'fr') { // Set French as the site default language. ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->config('system.site')->set('langcode', 'fr')->save(); + $this->config('system.site')->set('default_langcode', 'fr')->save(); // Reset the language manager so new negotiations attempts will fall back on // French. Reinject the language manager CKEditor to use the current one. diff --git a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php index 9ecf5ae..f21c30c 100644 --- a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php +++ b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php @@ -75,7 +75,7 @@ function testSiteNameTranslation() { // overrides still work. $language_manager = \Drupal::languageManager()->reset(); $this->assertTrue($language_manager->isMultilingual(), 'The test site is multilingual.'); - $this->config('system.site')->set('langcode', 'xx')->save(); + $this->config('system.site')->set('default_langcode', 'xx')->save(); ConfigurableLanguage::load('en')->delete(); $this->assertFalse($language_manager->isMultilingual(), 'The test site is monolingual.'); diff --git a/core/modules/language/src/EventSubscriber/ConfigSubscriber.php b/core/modules/language/src/EventSubscriber/ConfigSubscriber.php index 2b1c73c..ef3f65d 100644 --- a/core/modules/language/src/EventSubscriber/ConfigSubscriber.php +++ b/core/modules/language/src/EventSubscriber/ConfigSubscriber.php @@ -54,8 +54,8 @@ public function __construct(LanguageManagerInterface $language_manager, Language */ public function onConfigSave(ConfigCrudEvent $event) { $saved_config = $event->getConfig(); - if ($saved_config->getName() == 'system.site' && $event->isChanged('langcode')) { - $language = $this->languageManager->getLanguage($saved_config->get('langcode')); + if ($saved_config->getName() == 'system.site' && $event->isChanged('default_langcode')) { + $language = $this->languageManager->getLanguage($saved_config->get('default_langcode')); // During an import the language might not exist yet. if ($language) { $this->languageDefault->set($language); diff --git a/core/modules/language/src/LanguageListBuilder.php b/core/modules/language/src/LanguageListBuilder.php index b8f6454..aa018dc 100644 --- a/core/modules/language/src/LanguageListBuilder.php +++ b/core/modules/language/src/LanguageListBuilder.php @@ -152,7 +152,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Save the default language if changed. $new_id = $form_state->getValue('site_default_language'); if ($new_id != $this->languageManager->getDefaultLanguage()->getId()) { - $this->configFactory->getEditable('system.site')->set('langcode', $new_id)->save(); + $this->configFactory->getEditable('system.site')->set('default_langcode', $new_id)->save(); $this->languageManager->reset(); } diff --git a/core/modules/language/src/LanguageServiceProvider.php b/core/modules/language/src/LanguageServiceProvider.php index d7c4ddd..de2fa6f 100644 --- a/core/modules/language/src/LanguageServiceProvider.php +++ b/core/modules/language/src/LanguageServiceProvider.php @@ -97,7 +97,7 @@ protected function isMultilingual() { protected function getDefaultLanguageValues() { $config_storage = BootstrapConfigStorageFactory::get(); $system = $config_storage->read('system.site'); - $default_language = $config_storage->read(static::CONFIG_PREFIX . $system['langcode']); + $default_language = $config_storage->read(static::CONFIG_PREFIX . $system['default_langcode']); if (is_array($default_language)) { return $default_language; } diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php index f4e1378..1d4ee27 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php @@ -116,7 +116,7 @@ public function testDefaultLangcode() { $configurable_language = entity_load('configurable_language', $old_default->getId()); $this->assertTrue($configurable_language->isDefault(), 'The en language entity is flagged as the default language.'); - $this->config('system.site')->set('langcode', 'cc')->save(); + $this->config('system.site')->set('default_langcode', 'cc')->save(); ContentLanguageSettings::loadByEntityTypeBundle('entity_test','custom_bundle') ->setLanguageAlterable(TRUE) ->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT) diff --git a/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php b/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php index 1a7a815..46b3041 100644 --- a/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php +++ b/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php @@ -43,7 +43,7 @@ function testDependencyInjectedNewDefaultLanguage() { $default_language = ConfigurableLanguage::load(\Drupal::languageManager()->getDefaultLanguage()->getId()); // Change the language default object to different values. ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->config('system.site')->set('langcode', 'fr')->save(); + $this->config('system.site')->set('default_langcode', 'fr')->save(); // The language system creates a Language object which contains the // same properties as the new default language object. @@ -60,7 +60,7 @@ function testDependencyInjectedNewDefaultLanguage() { } // Re-save the previous default language and the delete should work. - $this->config('system.site')->set('langcode', $default_language->getId())->save(); + $this->config('system.site')->set('default_langcode', $default_language->getId())->save(); entity_delete_multiple('configurable_language', array('fr')); $result = \Drupal::languageManager()->getCurrentLanguage(); diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php index f801b6a..99d4778 100644 --- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php @@ -93,7 +93,7 @@ function testUILanguageNegotiation() { // be some bug. $default_language = \Drupal::languageManager()->getDefaultLanguage(); ConfigurableLanguage::createFromLangcode($langcode_browser_fallback)->save(); - $this->config('system.site')->set('langcode', $langcode_browser_fallback)->save(); + $this->config('system.site')->set('default_langcode', $langcode_browser_fallback)->save(); ConfigurableLanguage::createFromLangcode($langcode)->save(); // We will look for this string in the admin/config screen to see if the @@ -106,7 +106,7 @@ function testUILanguageNegotiation() { // Now the t()'ed string is in db so switch the language back to default. // This will rebuild the container so we need to rebuild the container in // the test environment. - $this->config('system.site')->set('langcode', $default_language->getId())->save(); + $this->config('system.site')->set('default_langcode', $default_language->getId())->save(); $this->config('language.negotiation')->set('url.prefixes.en', '')->save(); $this->rebuildContainer(); diff --git a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php index 0522010..ef53b8c 100644 --- a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php +++ b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php @@ -32,7 +32,7 @@ public function setUp() { // Change the language default object to different values. ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->config('system.site')->set('langcode', 'fr')->save(); + $this->config('system.site')->set('default_langcode', 'fr')->save(); $this->drupalLogin($this->rootUser); } diff --git a/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php b/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php index f94db02..a5786b1 100644 --- a/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php +++ b/core/modules/locale/src/Tests/LocaleTranslatedSchemaDefinitionTest.php @@ -30,7 +30,7 @@ class LocaleTranslatedSchemaDefinitionTest extends WebTestBase { protected function setUp() { parent::setUp(); ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->config('system.site')->set('langcode', 'fr')->save(); + $this->config('system.site')->set('default_langcode', 'fr')->save(); // Make sure new entity type definitions are processed. \Drupal::service('entity.definition_update_manager')->applyUpdates(); // Clear all caches so that the base field definition, its cache in the diff --git a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php index 59b0458..085722f 100644 --- a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php +++ b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php @@ -155,7 +155,7 @@ function testMenuLanguageRemovedEnglish() { // Remove English language. To do that another language has to be set as // default. - $this->config('system.site')->set('langcode', 'cs')->save(); + $this->config('system.site')->set('default_langcode', 'cs')->save(); entity_delete_multiple('configurable_language', array('en')); // Save the menu again and check if the language is still the same. diff --git a/core/modules/system/config/install/system.site.yml b/core/modules/system/config/install/system.site.yml index 10e2be2..403e464 100644 --- a/core/modules/system/config/install/system.site.yml +++ b/core/modules/system/config/install/system.site.yml @@ -9,3 +9,4 @@ page: admin_compact_mode: false weight_select_max: 100 langcode: en +default_langcode: en diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index 6888a56..ba8fa15 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -37,7 +37,10 @@ system.site: label: 'Weight element maximum value' langcode: type: string - label: 'Default language' + label: 'Language code' + default_langcode: + type: string + label: 'Site default language code' mail_notification: type: string label: 'Notification email address' diff --git a/core/modules/system/src/Tests/Common/FormatDateTest.php b/core/modules/system/src/Tests/Common/FormatDateTest.php index 63576fe..9d9a265 100644 --- a/core/modules/system/src/Tests/Common/FormatDateTest.php +++ b/core/modules/system/src/Tests/Common/FormatDateTest.php @@ -96,7 +96,7 @@ function testFormatDate() { $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London', 'en'), 'Monday, 26-Mar-07 01:00:00 BST', 'Test a different time zone.'); // Change the default language and timezone. - $this->config('system.site')->set('langcode', static::LANGCODE)->save(); + $this->config('system.site')->set('default_langcode', static::LANGCODE)->save(); date_default_timezone_set('America/Los_Angeles'); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test a different language.'); diff --git a/core/modules/system/src/Tests/Theme/TwigTransTest.php b/core/modules/system/src/Tests/Theme/TwigTransTest.php index 7f21b2d..85ba19a 100644 --- a/core/modules/system/src/Tests/Theme/TwigTransTest.php +++ b/core/modules/system/src/Tests/Theme/TwigTransTest.php @@ -70,7 +70,7 @@ protected function setUp() { $this->installLanguages(); // Assign Lolspeak (xx) to be the default language. - $this->config('system.site')->set('langcode', 'xx')->save(); + $this->config('system.site')->set('default_langcode', 'xx')->save(); $this->rebuildContainer(); // Check that lolspeak is the default language for the site. diff --git a/core/modules/taxonomy/src/Tests/TermLanguageTest.php b/core/modules/taxonomy/src/Tests/TermLanguageTest.php index 011404d..c679204 100644 --- a/core/modules/taxonomy/src/Tests/TermLanguageTest.php +++ b/core/modules/taxonomy/src/Tests/TermLanguageTest.php @@ -102,7 +102,7 @@ function testDefaultTermLanguage() { // Change the default language of the site and check if the default terms // language is still correctly selected. - $this->config('system.site')->set('langcode', 'cc')->save(); + $this->config('system.site')->set('default_langcode', 'cc')->save(); $edit = array( 'default_language[langcode]' => LanguageInterface::LANGCODE_SITE_DEFAULT, 'default_language[language_alterable]' => TRUE, diff --git a/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php index 10cc379..fbd6682 100644 --- a/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php +++ b/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php @@ -57,7 +57,7 @@ public function testCreateView() { // Add a new language and mark it as default. ConfigurableLanguage::createFromLangcode('it')->save(); - $this->config('system.site')->set('langcode', 'it')->save(); + $this->config('system.site')->set('default_langcode', 'it')->save(); $form_state->setValues([ 'id' => $random_id,