diff --git a/core/modules/language/language.module b/core/modules/language/language.module index aa09e1b..b0ad752 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -515,7 +515,7 @@ function language_save($language) { language_update_count(); // Update weight of locked system languages. - language_update_default_weight(); + language_update_locked_weights(); // Kill the static cache in language_list(). drupal_static_reset('language_list'); @@ -564,7 +564,7 @@ function language_delete($langcode) { language_update_count(); // Update weight of locked system languages. - language_update_default_weight(); + language_update_locked_weights(); drupal_static_reset('language_list'); @@ -863,15 +863,19 @@ function language_set_browser_drupal_langcode_mappings($mappings) { } /** - * Updates system languages weight. + * Updates locked system languages weight. * */ -function language_update_default_weight() { +function language_update_locked_weights() { // Get minimum weight to update the system languages to keep it on top. $max_weight = db_query('SELECT MAX(weight) FROM {language} WHERE locked = 0')->fetchField(); - // Update system languages weight. - db_update('language') - ->fields(array('weight' => $max_weight + 1)) - ->condition('langcode', array(LANGUAGE_NOT_SPECIFIED, LANGUAGE_NOT_APPLICABLE), 'IN') - ->execute(); + // Loop locked languages to maintain the existing order. + foreach (language_list(LANGUAGE_LOCKED) as $language) { + $max_weight ++; + // Update system languages weight. + db_update('language') + ->fields(array('weight' => $max_weight)) + ->condition('langcode', $language->langcode) + ->execute(); + } } diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php index 46e6e1c..e949a60 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php @@ -23,7 +23,7 @@ class LanguageConfigurationTest extends WebTestBase { public static function getInfo() { return array( - 'name' => 'Language negotiation auto configuration', + 'name' => 'Language negotiation autoconfiguration', 'description' => 'Adds and configures languages to check negotiation changes.', 'group' => 'Language', );