diff --cc core/includes/form.inc index 838a156,8cef7b0..0000000 --- a/core/includes/form.inc +++ b/core/includes/form.inc diff --cc core/lib/Drupal/Core/Entity/EntityManager.php index 26eac4e,83a0284..0000000 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@@ -832,8 -839,7 +832,8 @@@ class EntityManager extends DefaultPlug protected function getAllDisplayModesByEntityType($display_type) { if (!isset($this->displayModeInfo[$display_type])) { $key = 'entity_' . $display_type . '_info'; + $entity_type_id = 'entity_' . $display_type; - $langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_INTERFACE)->id; + $langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_INTERFACE)->getId(); if ($cache = $this->cacheBackend->get("$key:$langcode")) { $this->displayModeInfo[$display_type] = $cache->data; } diff --cc core/lib/Drupal/Core/Language/LanguageManager.php index d86789e,fe2cc58..0000000 --- a/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@@ -145,10 -120,8 +145,10 @@@ class LanguageManager implements Langua // Add the site's default language if flagged as allowed value. if ($flags & LanguageInterface::STATE_SITE_DEFAULT) { $default = isset($default) ? $default : $this->getDefaultLanguage(); - // Rename the default language. - $default->setName($this->t("Site's default language (@lang_name)", array('@lang_name' => $default->getName()))); + // Rename the default language. But we do not want to do this globally, + // if we're acting on a global object, so clone the object first. + $default = clone $default; - $default->name = $this->t("Site's default language (@lang_name)", array('@lang_name' => $default->name)); ++ $default->name = $this->t("Site's default language (@lang_name)", array('@lang_name' => $default->getName())); $filtered_languages['site_default'] = $default; } diff --cc core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index 22bcaaf,a5eb69a..0000000 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@@ -325,7 -325,7 +325,7 @@@ class ConfigTranslationUiTest extends W // Test that delete links work and operations perform properly. foreach ($this->langcodes as $langcode) { - $replacements = array('%label' => t('!label !entity_type', array('!label' => $label, '!entity_type' => Unicode::strtolower(t('Contact form')))), '@language' => language_load($langcode)->name); - $replacements = array('%label' => t('!label !entity_type', array('!label' => $label, '!entity_type' => Unicode::strtolower(t('Contact category')))), '@language' => language_load($langcode)->getName()); ++ $replacements = array('%label' => t('!label !entity_type', array('!label' => $label, '!entity_type' => Unicode::strtolower(t('Contact form')))), '@language' => language_load($langcode)->getName()); $this->drupalGet("$translation_base_url/$langcode/delete"); $this->assertRaw(t('Are you sure you want to delete the @language translation of %label?', $replacements)); diff --cc core/modules/contact/src/Tests/ContactSitewideTest.php index 436b2bf,e16cc87..0000000 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@@ -107,26 -107,26 +107,26 @@@ class ContactSitewideTest extends WebTe $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com'); $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH; $max_length_exceeded = $max_length + 1; - $this->addCategory($id = drupal_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE); + $this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE); $this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded))); - $this->addCategory($id = drupal_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + $this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE); + $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); - // Create first valid category. - $this->addCategory($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + // Create first valid form. + $this->addContactForm($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE); + $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); - // Check that the category was created in site default language. - $langcode = \Drupal::config('contact.category.' . $id)->get('langcode'); + // Check that the form was created in site default language. + $langcode = \Drupal::config('contact.form.' . $id)->get('langcode'); - $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->id; + $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); $this->assertEqual($langcode, $default_langcode); - // Make sure the newly created category is included in the list of categories. - $this->assertNoUniqueText($label, 'New category included in categories list.'); + // Make sure the newly created form is included in the list of forms. + $this->assertNoUniqueText($label, 'New form included in forms list.'); - // Test update contact form category. - $this->updateCategory($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE); - $config = \Drupal::config('contact.category.' . $id)->get(); + // Test update contact form. + $this->updateContactForm($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE); + $config = \Drupal::config('contact.form.' . $id)->get(); $this->assertEqual($config['label'], $label); $this->assertEqual($config['recipients'], array($recipients[0], $recipients[1])); $this->assertEqual($config['reply'], $reply); diff --cc core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php index 5f12452,c6a4afa..0000000 --- a/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php diff --cc core/modules/content_translation/src/ContentTranslationHandler.php index 60eb6f3,0af6d08..0000000 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@@ -84,9 -84,9 +84,9 @@@ class ContentTranslationHandler impleme * {@inheritdoc} */ public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) { - $form_controller = content_translation_form_controller($form_state); - $form_langcode = $form_controller->getFormLangcode($form_state); + $form_object = $form_state->getFormObject(); + $form_langcode = $form_object->getFormLangcode($form_state); - $entity_langcode = $entity->getUntranslated()->language()->id; + $entity_langcode = $entity->getUntranslated()->language()->getId(); $source_langcode = $this->getSourceLangcode($form_state); $new_translation = !empty($source_langcode); @@@ -443,10 -439,10 +443,10 @@@ $form_state->setRedirect('content_translation.translation_add_' . $entity_type_id, array( $entity_type_id => $entity->id(), 'source' => $source, - 'target' => $form_controller->getFormLangcode($form_state), + 'target' => $form_object->getFormLangcode($form_state), )); $languages = language_list(); - drupal_set_message(t('Source language set to: %language', array('%language' => $languages[$source]->name))); + drupal_set_message(t('Source language set to: %language', array('%language' => $languages[$source]->getName()))); } /** diff --cc core/modules/field/src/Plugin/views/field/Field.php index 0bd93b2,c2a6a79..0000000 --- a/core/modules/field/src/Plugin/views/field/Field.php +++ b/core/modules/field/src/Plugin/views/field/Field.php diff --cc core/modules/language/src/Form/NegotiationUrlForm.php index e2e241e,7ed9979..0000000 --- a/core/modules/language/src/Form/NegotiationUrlForm.php +++ b/core/modules/language/src/Form/NegotiationUrlForm.php @@@ -73,17 -73,17 +73,17 @@@ class NegotiationUrlForm extends Config $prefixes = language_negotiation_url_prefixes(); $domains = language_negotiation_url_domains(); foreach ($languages as $langcode => $language) { - $t_args = array('%language' => $language->name, '%langcode' => $language->id); + $t_args = array('%language' => $language->getName(), '%langcode' => $language->getId()); $form['prefix'][$langcode] = array( '#type' => 'textfield', - '#title' => $language->default ? $this->t('%language (%langcode) path prefix (Default language)', $t_args) : $this->t('%language (%langcode) path prefix', $t_args), - '#title' => $language->isDefault() ? t('%language (%langcode) path prefix (Default language)', $t_args) : t('%language (%langcode) path prefix', $t_args), ++ '#title' => $language->isDefault() ? $this->t('%language (%langcode) path prefix (Default language)', $t_args) : $this->t('%language (%langcode) path prefix', $t_args), '#maxlength' => 64, '#default_value' => isset($prefixes[$langcode]) ? $prefixes[$langcode] : '', '#field_prefix' => $base_url . '/', ); $form['domain'][$langcode] = array( '#type' => 'textfield', - '#title' => $this->t('%language (%langcode) domain', array('%language' => $language->name, '%langcode' => $language->id)), - '#title' => t('%language (%langcode) domain', array('%language' => $language->getName(), '%langcode' => $language->getId())), ++ '#title' => $this->t('%language (%langcode) domain', array('%language' => $language->getName(), '%langcode' => $language->getId())), '#maxlength' => 128, '#default_value' => isset($domains[$langcode]) ? $domains[$langcode] : '', ); @@@ -106,10 -106,10 +106,10 @@@ $value = $form_state->getValue(array('prefix', $langcode)); if ($value === '') { - if (!$language->default && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) { + if (!$language->isDefault() && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) { // Throw a form error if the prefix is blank for a non-default language, // although it is required for selected negotiation type. - $form_state->setErrorByName("prefix][$langcode", t('The prefix may only be left blank for the default language.')); + $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix may only be left blank for the default language.')); } } elseif (strpos($value, '/') !== FALSE) { @@@ -120,7 -120,7 +120,7 @@@ elseif (isset($count[$value]) && $count[$value] > 1) { // Throw a form error if there are two languages with the same // domain/prefix. - $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix for %language, %value, is not unique.', array('%language' => $language->name, '%value' => $value))); - $form_state->setErrorByName("prefix][$langcode", t('The prefix for %language, %value, is not unique.', array('%language' => $language->getName(), '%value' => $value))); ++ $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix for %language, %value, is not unique.', array('%language' => $language->getName(), '%value' => $value))); } } @@@ -130,16 -130,16 +130,16 @@@ $value = $form_state->getValue(array('domain', $langcode)); if ($value === '') { - if (!$language->default && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_DOMAIN) { + if (!$language->isDefault() && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_DOMAIN) { // Throw a form error if the domain is blank for a non-default language, // although it is required for selected negotiation type. - $form_state->setErrorByName("domain][$langcode", t('The domain may only be left blank for the default language.')); + $form_state->setErrorByName("domain][$langcode", $this->t('The domain may only be left blank for the default language.')); } } elseif (isset($count[$value]) && $count[$value] > 1) { // Throw a form error if there are two languages with the same // domain/domain. - $form_state->setErrorByName("domain][$langcode", $this->t('The domain for %language, %value, is not unique.', array('%language' => $language->name, '%value' => $value))); - $form_state->setErrorByName("domain][$langcode", t('The domain for %language, %value, is not unique.', array('%language' => $language->getName(), '%value' => $value))); ++ $form_state->setErrorByName("domain][$langcode", $this->t('The domain for %language, %value, is not unique.', array('%language' => $language->getName(), '%value' => $value))); } } diff --cc core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorFeedTest.php index 66bc81f,c444c99..0000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorFeedTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorFeedTest.php @@@ -42,7 -43,7 +42,7 @@@ class MigrateAggregatorFeedTest extend $feed = entity_load('aggregator_feed', 5); $this->assertNotNull($feed->uuid()); $this->assertEqual($feed->title->value, 'Know Your Meme'); - $this->assertEqual($feed->language()->id, 'en'); - $this->assertEqual($feed->language()->getId(), LanguageInterface::LANGCODE_NOT_SPECIFIED); ++ $this->assertEqual($feed->language()->getId(), 'en'); $this->assertEqual($feed->url->value, 'http://knowyourmeme.com/newsfeed.rss'); $this->assertEqual($feed->refresh->value, 900); $this->assertEqual($feed->checked->value, 1387659487); diff --cc core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorItemTest.php index b2c200a,6e7ca97..0000000 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorItemTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorItemTest.php @@@ -67,7 -67,7 +67,7 @@@ class MigrateAggregatorItemTest extend $this->assertEqual($item->getDescription(), "