reverted: --- b/core/modules/hal/src/Tests/NormalizeTest.php +++ a/core/modules/hal/src/Tests/NormalizeTest.php @@ -79,13 +79,13 @@ ), $relation_uri => array( array( + 'href' => $this->getEntityUri($target_entity_de), + 'lang' => 'de', + ), + array( 'href' => $this->getEntityUri($target_entity_en), 'lang' => 'en', ), - array( - 'href' => $this->getEntityUri($target_entity_de), - 'lang' => 'de', - ), ), ), '_embedded' => array( @@ -93,7 +93,7 @@ array( '_links' => array( 'self' => array( + 'href' => $this->getEntityUri($target_entity_de), - 'href' => $this->getEntityUri($target_entity_en), ), 'type' => array( 'href' => $type_uri, @@ -101,15 +101,15 @@ ), 'uuid' => array( array( + 'value' => $target_entity_de->uuid(), - 'value' => $target_entity_en->uuid(), ), ), + 'lang' => 'de', - 'lang' => 'en', ), array( '_links' => array( 'self' => array( + 'href' => $this->getEntityUri($target_entity_en), - 'href' => $this->getEntityUri($target_entity_de), ), 'type' => array( 'href' => $type_uri, @@ -117,10 +117,10 @@ ), 'uuid' => array( array( + 'value' => $target_entity_en->uuid(), - 'value' => $target_entity_de->uuid(), ), ), + 'lang' => 'en', - 'lang' => 'de', ), ), ), @@ -136,13 +136,13 @@ ), 'name' => array( array( + 'value' => $values['name'], + 'lang' => 'de', + ), + array( 'value' => $translation_values['name'], 'lang' => 'en', ), - array( - 'value' => $values['name'], - 'lang' => 'de', - ), ), 'field_test_text' => array( array( reverted: --- b/core/modules/language/src/ConfigurableLanguageManager.php +++ a/core/modules/language/src/ConfigurableLanguageManager.php @@ -353,11 +353,10 @@ if (reset($locked_languages)->getWeight() <= $max_weight) { foreach ($locked_languages as $language) { // Update system languages weight. + $max_weight++; + ConfigurableLanguage::load($language->getId()) + ->setWeight($max_weight) + ->save(); - if ($language = ConfigurableLanguage::load($language->getId())) { - $max_weight++; - $language->setWeight($max_weight) - ->save(); - } } } } diff -u b/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php --- b/core/modules/language/src/Entity/ConfigurableLanguage.php +++ b/core/modules/language/src/Entity/ConfigurableLanguage.php @@ -121,18 +121,14 @@ // For the uncommon case of custom languages the label should be given in // English. $this->langcode = 'en'; + // When adding a new language the weight shouldn't be zero to avoid a // reordering of the languages list when their names change i.e. interface // translation. - // Fetch all configurable languages ordered by weight. - $languages = \Drupal::languageManager()->getLanguages($this::STATE_CONFIGURABLE); - // Retrieve the last. - $last_language = end($languages); - // When adding the first Configurable language leave the weight by default. - // This happens when you are installing language module. - if ($this->isNew() && $last_language->getId() != $this->getId()) { - // The newly created language will have the weight of the heaviest - // language +1. + if ($this->id != 'en' && $this->isNew() && !$this->isLocked() && $this->getWeight() == 0) { + // Fetch all configurable languages ordered by weight. + $languages = \Drupal::languageManager()->getLanguages($this::STATE_CONFIGURABLE); + $last_language = end($languages); $this->setWeight($last_language->getWeight() + 1); } } @@ -145,7 +141,7 @@ $language_manager = \Drupal::languageManager(); $language_manager->reset(); - if (!$this->isLocked() && $language_manager instanceof ConfigurableLanguageManagerInterface) { + if (!$this->isLocked() && $language_manager instanceof ConfigurableLanguageManagerInterface && !$this->isSyncing()) { $language_manager->updateLockedLanguageWeights(); } @@ -187,7 +183,8 @@ parent::postDelete($storage, $entities); $language_manager = \Drupal::languageManager(); $language_manager->reset(); - if ($language_manager instanceof ConfigurableLanguageManagerInterface) { + $entity = reset($entities); + if ($language_manager instanceof ConfigurableLanguageManagerInterface && !$entity->isUninstalling() && !$entity->isSyncing()) { $language_manager->updateLockedLanguageWeights(); } // If after deleting this language the site will become monolingual, we need only in patch2: unchanged: --- a/core/modules/ckeditor/src/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php @@ -384,6 +384,7 @@ function testLanguages() { */ function testJSTranslation() { $this->enableModules(array('language', 'locale')); + $this->installConfig(['language']); $this->installSchema('locale', 'locales_source'); $this->installSchema('locale', 'locales_location'); $this->installSchema('locale', 'locales_target'); only in patch2: unchanged: --- a/core/modules/config/src/Tests/ConfigLanguageOverrideTest.php +++ b/core/modules/config/src/Tests/ConfigLanguageOverrideTest.php @@ -29,7 +29,7 @@ class ConfigLanguageOverrideTest extends KernelTestBase { */ protected function setUp() { parent::setUp(); - $this->installConfig(array('config_test')); + $this->installConfig(array('config_test', 'language')); } /** only in patch2: unchanged: --- a/core/modules/language/src/Tests/EntityDefaultLanguageTest.php +++ b/core/modules/language/src/Tests/EntityDefaultLanguageTest.php @@ -30,7 +30,7 @@ class EntityDefaultLanguageTest extends KernelTestBase { */ public function setUp() { parent::setUp(); - + $this->installConfig(['language']); $this->installEntitySchema('user'); // Activate Spanish language, so there are two languages activated. only in patch2: unchanged: --- a/core/modules/language/src/Tests/LanguageConfigOverrideInstallTest.php +++ b/core/modules/language/src/Tests/LanguageConfigOverrideInstallTest.php @@ -24,6 +24,14 @@ class LanguageConfigOverrideInstallTest extends KernelTestBase { public static $modules = array('language', 'config_events_test'); /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $this->installConfig(['language']); + } + + /** * Tests the configuration events are not fired during install of overrides. */ public function testLanguageConfigOverrideInstall() { only in patch2: unchanged: --- a/core/modules/locale/src/Tests/LocaleConfigManagerTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigManagerTest.php @@ -29,7 +29,7 @@ class LocaleConfigManagerTest extends KernelTestBase { */ public function testHasTranslation() { $this->installSchema('locale', array('locales_location')); - $this->installConfig(array('locale_test')); + $this->installConfig(array('locale_test', 'language')); $locale_config_manager = \Drupal::service('locale.config.typed'); $language = ConfigurableLanguage::createFromLangcode('de'); only in patch2: unchanged: --- a/core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigSubscriberTest.php @@ -72,7 +72,7 @@ protected function setUp() { $this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']); - $this->installConfig(['locale_test']); + $this->installConfig(['locale_test', 'language']); ConfigurableLanguage::createFromLangcode($this->langcode)->save(); }