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..b7951ca 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,22 @@ 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->assertResponse(200, 'Translation edit page is alright');
+ }
+ }
+ }
+
}
diff --git a/core/modules/node/src/NodeTranslationHandler.php b/core/modules/node/src/NodeTranslationHandler.php
index 3692c8b..2ad375e 100644
--- a/core/modules/node/src/NodeTranslationHandler.php
+++ b/core/modules/node/src/NodeTranslationHandler.php
@@ -7,6 +7,7 @@
namespace Drupal\node;
+use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\content_translation\ContentTranslationHandler;
use Drupal\Core\Form\FormStateInterface;
@@ -68,7 +69,10 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
*/
protected function entityFormTitle(EntityInterface $entity) {
$type_name = node_get_type_label($entity);
- return t('Edit @type @title', array('@type' => $type_name, '@title' => $entity->label()));
+ return String::format('%edit @title', array(
+ '%edit' => t('Edit @type', array('@type' => $type_name)),
+ '@title' => $entity->label(),
+ ));
}
/**
diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php
index d16d13a..3c121b4 100644
--- a/core/modules/node/src/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/src/Tests/NodeTranslationUITest.php
@@ -12,6 +12,7 @@
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\node\Entity\Node;
+use Drupal\Component\Utility\String;
/**
* Tests the Node Translation UI.
@@ -373,4 +374,43 @@ 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);
+ $this->assertResponse(200, 'Translation edit page is alright');
+
+ $title = String::format('%edit @title', array(
+ '%edit' => t('Edit @type', array('@type' => $type_name)),
+ '@title' => $entity->getTranslation($langcode)->label(),
+ ));
+ $title = t('!title [%language translation]', array(
+ '!title' => $title,
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertRaw($title);
+
+ $title = t('Edit @type @title', array(
+ '@type' => $type_name,
+ '@title' => $entity->getTranslation($langcode)->label(),
+ ));
+ $title = t('!title [%language translation]', array(
+ '!title' => $title,
+ '%language' => $languages[$langcode]->getName(),
+ ));
+ $this->assertNoRaw(String::checkPlain($title));
+ }
+ }
+ }
+
}