diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
index 063cf5a..6824c47 100644
--- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
@@ -163,4 +163,28 @@ public function testDisabledBundle() {
$this->assertEqual(1, count($rows));
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('Edit @type @title [%language translation]', array(
+ '@type' => $entity->bundle(),
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php
index 0bed6e0..28fddbd 100644
--- a/core/modules/comment/src/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php
@@ -182,4 +182,28 @@ function testTranslateLinkCommentAdminPage() {
$this->assertNoLinkByHref('comment/' . $cid_untranslatable . '/translations');
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('Edit @type @title [%language translation]', array(
+ '@type' => $this->entityTypeId,
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php
index 2d6b19d..a475332 100644
--- a/core/modules/content_translation/src/ContentTranslationHandler.php
+++ b/core/modules/content_translation/src/ContentTranslationHandler.php
@@ -246,8 +246,8 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
$title = $this->entityFormTitle($entity);
// When editing the original values display just the entity label.
if ($form_langcode != $entity_langcode) {
- $t_args = array('%language' => $languages[$form_langcode]->getName(), '%title' => $entity->label());
- $title = empty($source_langcode) ? $title . ' [' . t('%language translation', $t_args) . ']' : t('Create %language translation of %title', $t_args);
+ $t_args = array('%language' => $languages[$form_langcode]->getName(), '%title' => $entity->label(), '!title' => $title);
+ $title = empty($source_langcode) ? t('!title [%language translation]', $t_args) : t('Create %language translation of %title', $t_args);
}
$form['#title'] = $title;
}
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
index 41bcf95..2a8d680 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
@@ -41,6 +41,7 @@ function testTranslationUI() {
$this->doTestOutdatedStatus();
$this->doTestPublishedStatus();
$this->doTestAuthoringInfo();
+ $this->doTestTranslationEdit();
$this->doTestTranslationDeletion();
}
@@ -364,4 +365,23 @@ protected function getValue(EntityInterface $translation, $property, $langcode)
return $translation->get($property)->{$key};
}
+ /**
+ * Tests edit content translation.
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $this->assertRaw($entity->getTranslation($langcode)->label());
+ }
+ }
+ }
+
}
diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php b/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php
index 315d018..0986fc6 100644
--- a/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php
+++ b/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php
@@ -94,4 +94,27 @@ function testTranslationLinkTheme() {
$this->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme as well.');
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('@title [%language translation]', array(
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php
index d16d13a..68789a5 100644
--- a/core/modules/node/src/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/src/Tests/NodeTranslationUITest.php
@@ -50,7 +50,7 @@ protected function setUp() {
}
/**
- * Tests the basic translation UI.
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::testTranslationUI().
*/
function testTranslationUI() {
parent::testTranslationUI();
@@ -373,4 +373,29 @@ protected function doUninstallTest() {
$this->assertEqual($language_count, count(\Drupal::configFactory()->listAll('language.content_settings.')), 'Languages have been fixed rather than deleted during content_translation uninstall.');
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+ $type_name = node_get_type_label($entity);
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('Edit @type @title [%language translation]', array(
+ '@type' => $type_name,
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
index 5f70a23..1f5ebbf 100644
--- a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
@@ -79,4 +79,27 @@ protected function doTestBasicTranslation() {
}
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('@title [%language translation]', array(
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/taxonomy/src/Tests/TermTranslationUITest.php b/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
index 07400a5..739e243 100644
--- a/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
+++ b/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
@@ -139,4 +139,27 @@ function testTranslateLinkVocabularyAdminPage() {
$this->assertNoLinkByHref('term/' . $untranslatable_tid . '/translations');
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('@title [%language translation]', array(
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}
diff --git a/core/modules/user/src/Tests/UserTranslationUITest.php b/core/modules/user/src/Tests/UserTranslationUITest.php
index 524e645..dcd3d80 100644
--- a/core/modules/user/src/Tests/UserTranslationUITest.php
+++ b/core/modules/user/src/Tests/UserTranslationUITest.php
@@ -54,4 +54,27 @@ protected function getNewEntityValues($langcode) {
return array('name' => $this->name) + parent::getNewEntityValues($langcode);
}
+ /**
+ * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertTranslationEdit().
+ */
+ protected function doTestTranslationEdit() {
+ $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
+ $languages = $this->container->get('language_manager')->getLanguages();
+
+ foreach ($this->langcodes as $langcode) {
+ // We only want to test the title for non-english translations.
+ if ($langcode != 'en') {
+ $options = array('language' => $languages[$langcode]);
+ $url = $entity->urlInfo('edit-form', $options);
+ $this->drupalGet($url);
+
+ $title = t('@title [%language translation]', array(
+ '@title' => $entity->getTranslation($langcode)->label(),
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+ }
+ }
+ }
+
}