diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index 44bbc95..ae995b9 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -8,6 +8,7 @@ use Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\StringTranslation\TranslationWrapper; use Drupal\field\FieldConfigInterface; use Symfony\Component\Routing\Exception\RouteNotFoundException; @@ -144,7 +145,7 @@ function config_translation_config_translation_info(&$info) { $info[$entity_type_id] = array( 'class' => '\Drupal\config_translation\ConfigEntityMapper', 'base_route_name' => $base_route_name, - 'title' => '!label !entity_type', + 'title' => $entity_type->getLowercaseLabel(), 'names' => array(), 'entity_type' => $entity_type_id, 'weight' => 10, diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 4342a79..c6605f1 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -154,11 +154,7 @@ public function setEntity(ConfigEntityInterface $entity) { * {@inheritdoc} */ public function getTitle() { - // Title based on the entity label. Should be translated for display in the - // current page language. The title placeholder is later escaped for - // display. - $entity_type_info = $this->entityManager->getDefinition($this->entityType); - return $this->t($this->pluginDefinition['title'], array('@label' => $this->entity->label(), '!entity_type' => $entity_type_info->getLowercaseLabel())); + return $this->entity->label() . ' ' . $this->pluginDefinition['title']; } /** diff --git a/core/modules/config_translation/src/FormElement/FormElementBase.php b/core/modules/config_translation/src/FormElement/FormElementBase.php index de6b714..9f6261d 100644 --- a/core/modules/config_translation/src/FormElement/FormElementBase.php +++ b/core/modules/config_translation/src/FormElement/FormElementBase.php @@ -101,7 +101,7 @@ protected function getSourceElement(LanguageInterface $source_language, $source_ return array( '#type' => 'item', '#title' => $this->t('@label (!source_language)', array( - '@label' => $this->t($this->definition->getLabel()), + '@label' => $this->definition->getLabel(), '!source_language' => $source_language->getName(), )), '#markup' => $value, @@ -162,8 +162,8 @@ protected function getSourceElement(LanguageInterface $source_language, $source_ protected function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) { // Add basic properties that apply to all form elements. return array( - '#title' => $this->t('!label (!source_language)', array( - '!label' => $this->t($this->definition['label']), + '#title' => $this->t('@label (!source_language)', array( + '@label' => $this->definition['label'], '!source_language' => $translation_language->getName(), )), '#default_value' => $translation_config, diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php index 687da5b..82a615d 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php @@ -7,6 +7,7 @@ namespace Drupal\config_translation\Tests; +use Drupal\Component\Utility\Html; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\WebTestBase; @@ -116,8 +117,8 @@ public function testMapperListPage() { $entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId()); $this->drupalGet($base_url . '/translate'); - $title = t('@label @entity_type', array('@label' => $test_entity->label(), '@entity_type' => $entity_type->getLowercaseLabel())); - $title = t('Translations for %label', array('%label' => $title)); + $title = $test_entity->label() . $entity_type->getLowercaseLabel(); + $title = 'Translations for ' . Html::escape($title) . ''; $this->assertRaw($title); $this->assertRaw('' . t('Language') . ''); diff --git a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php index 8041931..efbe68d 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php @@ -70,7 +70,7 @@ protected function setUp() { $definition = array( 'class' => '\Drupal\config_translation\ConfigEntityMapper', 'base_route_name' => 'entity.configurable_language.edit_form', - 'title' => '!label language', + 'title' => '@label language', 'names' => array(), 'entity_type' => 'configurable_language', 'route_name' => 'config_translation.item.overview.entity.configurable_language.edit_form', diff --git a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php index 740b722..3a78357 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php @@ -50,7 +50,7 @@ protected function setUp() { $definition = array( 'class' => '\Drupal\config_translation\ConfigFieldMapper', 'base_route_name' => 'entity.field_config.node_field_edit_form', - 'title' => '!label field', + 'title' => '@label field', 'names' => array(), 'entity_type' => 'field_config', );