Commit 079a52b4 authored by catch's avatar catch

Revert "Issue #2457653 by Gábor Hojtsy: System.site langcode is both used as a...

Revert "Issue #2457653 by Gábor Hojtsy: System.site langcode is both used as a file language code and a site language code"

This reverts commit 364a6e9c.
parent 92ee8c54
......@@ -1664,10 +1664,7 @@ 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)
->set('default_langcode', $langcode)
->save();
\Drupal::configFactory()->getEditable('system.site')->set('langcode', $langcode)->save();
\Drupal::service('language.default')->set($language);
if (empty($install_state['profile_info']['keep_english'])) {
entity_delete_multiple('configurable_language', array('en'));
......
......@@ -620,7 +620,6 @@ 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();
}
}
......
......@@ -145,7 +145,7 @@ function testPerUserLoginFloodControl() {
*/
function testLocale() {
ConfigurableLanguage::createFromLangcode('de')->save();
$this->config('system.site')->set('default_langcode', 'de')->save();
$this->config('system.site')->set('langcode', 'de')->save();
$account = $this->drupalCreateUser();
$url = Url::fromRoute('router_test.11');
......
......@@ -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('default_langcode', 'fr')->save();
$this->config('system.site')->set('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.
......
......@@ -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('default_langcode', 'xx')->save();
$this->config('system.site')->set('langcode', 'xx')->save();
ConfigurableLanguage::load('en')->delete();
$this->assertFalse($language_manager->isMultilingual(), 'The test site is monolingual.');
......
......@@ -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('default_langcode')) {
$language = $this->languageManager->getLanguage($saved_config->get('default_langcode'));
if ($saved_config->getName() == 'system.site' && $event->isChanged('langcode')) {
$language = $this->languageManager->getLanguage($saved_config->get('langcode'));
// During an import the language might not exist yet.
if ($language) {
$this->languageDefault->set($language);
......
......@@ -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('default_langcode', $new_id)->save();
$this->configFactory->getEditable('system.site')->set('langcode', $new_id)->save();
$this->languageManager->reset();
}
......
......@@ -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['default_langcode']);
$default_language = $config_storage->read(static::CONFIG_PREFIX . $system['langcode']);
if (is_array($default_language)) {
return $default_language;
}
......
......@@ -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('default_langcode', 'cc')->save();
$this->config('system.site')->set('langcode', 'cc')->save();
ContentLanguageSettings::loadByEntityTypeBundle('entity_test','custom_bundle')
->setLanguageAlterable(TRUE)
->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT)
......
......@@ -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('default_langcode', 'fr')->save();
$this->config('system.site')->set('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('default_langcode', $default_language->getId())->save();
$this->config('system.site')->set('langcode', $default_language->getId())->save();
entity_delete_multiple('configurable_language', array('fr'));
$result = \Drupal::languageManager()->getCurrentLanguage();
......
......@@ -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('default_langcode', $langcode_browser_fallback)->save();
$this->config('system.site')->set('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('default_langcode', $default_language->getId())->save();
$this->config('system.site')->set('langcode', $default_language->getId())->save();
$this->config('language.negotiation')->set('url.prefixes.en', '')->save();
$this->rebuildContainer();
......
......@@ -32,7 +32,7 @@ public function setUp() {
// Change the language default object to different values.
ConfigurableLanguage::createFromLangcode('fr')->save();
$this->config('system.site')->set('default_langcode', 'fr')->save();
$this->config('system.site')->set('langcode', 'fr')->save();
$this->drupalLogin($this->rootUser);
}
......
......@@ -30,7 +30,7 @@ class LocaleTranslatedSchemaDefinitionTest extends WebTestBase {
protected function setUp() {
parent::setUp();
ConfigurableLanguage::createFromLangcode('fr')->save();
$this->config('system.site')->set('default_langcode', 'fr')->save();
$this->config('system.site')->set('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
......
......@@ -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('default_langcode', 'cs')->save();
$this->config('system.site')->set('langcode', 'cs')->save();
entity_delete_multiple('configurable_language', array('en'));
// Save the menu again and check if the language is still the same.
......
......@@ -9,4 +9,3 @@ page:
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en
......@@ -37,10 +37,7 @@ system.site:
label: 'Weight element maximum value'
langcode:
type: string
label: 'Language code'
default_langcode:
type: string
label: 'Site default language code'
label: 'Default language'
mail_notification:
type: string
label: 'Notification email address'
......
......@@ -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('default_langcode', static::LANGCODE)->save();
$this->config('system.site')->set('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.');
......
......@@ -70,7 +70,7 @@ protected function setUp() {
$this->installLanguages();
// Assign Lolspeak (xx) to be the default language.
$this->config('system.site')->set('default_langcode', 'xx')->save();
$this->config('system.site')->set('langcode', 'xx')->save();
$this->rebuildContainer();
// Check that lolspeak is the default language for the site.
......
......@@ -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('default_langcode', 'cc')->save();
$this->config('system.site')->set('langcode', 'cc')->save();
$edit = array(
'default_language[langcode]' => LanguageInterface::LANGCODE_SITE_DEFAULT,
'default_language[language_alterable]' => TRUE,
......
......@@ -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('default_langcode', 'it')->save();
$this->config('system.site')->set('langcode', 'it')->save();
$form_state->setValues([
'id' => $random_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment