Revert "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 079a52b45d
.
8.0.x
parent
079a52b45d
commit
3fbe92b02b
|
@ -1664,7 +1664,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'));
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class BasicAuthTest extends WebTestBase {
|
|||
*/
|
||||
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');
|
||||
|
|
|
@ -406,7 +406,7 @@ class CKEditorTest extends KernelTestBase {
|
|||
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.
|
||||
|
|
|
@ -75,7 +75,7 @@ class ConfigLanguageOverrideWebTest extends WebTestBase {
|
|||
// 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.');
|
||||
|
|
|
@ -54,8 +54,8 @@ class ConfigSubscriber implements EventSubscriberInterface {
|
|||
*/
|
||||
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);
|
||||
|
|
|
@ -152,7 +152,7 @@ class LanguageListBuilder extends DraggableListBuilder {
|
|||
// 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class LanguageServiceProvider extends ServiceProviderBase {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class LanguageConfigurationElementTest extends WebTestBase {
|
|||
$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)
|
||||
|
|
|
@ -43,7 +43,7 @@ class LanguageDependencyInjectionTest extends LanguageTestBase {
|
|||
$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 @@ class LanguageDependencyInjectionTest extends LanguageTestBase {
|
|||
}
|
||||
|
||||
// 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();
|
||||
|
|
|
@ -93,7 +93,7 @@ class LanguageUILanguageNegotiationTest extends WebTestBase {
|
|||
// 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 @@ class LanguageUILanguageNegotiationTest extends WebTestBase {
|
|||
// 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();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class LocaleLocaleLookupTest extends WebTestBase {
|
|||
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -155,7 +155,7 @@ class MenuLanguageTest extends MenuWebTestBase {
|
|||
|
||||
// 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.
|
||||
|
|
|
@ -9,3 +9,4 @@ page:
|
|||
admin_compact_mode: false
|
||||
weight_select_max: 100
|
||||
langcode: en
|
||||
default_langcode: en
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -96,7 +96,7 @@ class FormatDateTest extends WebTestBase {
|
|||
$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.');
|
||||
|
|
|
@ -70,7 +70,7 @@ class TwigTransTest extends WebTestBase {
|
|||
$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.
|
||||
|
|
|
@ -102,7 +102,7 @@ class TermLanguageTest extends TaxonomyTestBase {
|
|||
|
||||
// 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,
|
||||
|
|
|
@ -57,7 +57,7 @@ class WizardPluginBaseUnitTest extends ViewUnitTestBase {
|
|||
|
||||
// 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,
|
||||
|
|
Loading…
Reference in New Issue