diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index 3d0741b..13dc3ff 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -86,6 +86,9 @@ protected function setUp() { 'access contextual links', 'administer views', 'administer account settings', + 'administer themes', + 'bypass node access', + 'administer content types', ) ); // Create and login user. @@ -379,6 +382,34 @@ public function testContactConfigEntityTranslation() { } /** + * Tests the node type translation. + */ + public function testNodeTypeTranslation() { + $type = Unicode::strtolower($this->randomMachineName(16)); + $name = $this->randomString(); + $this->drupalLogin($this->admin_user); + $this->drupalCreateContentType(array('type' => $type, 'name' => $name)); + + // Translate the node type name. + $langcode = $this->langcodes[0]; + $translated_name = $langcode . '-' . $name; + $edit = array( + "translation[config_names][node.type.$type][name]" => $translated_name, + ); + $this->drupalPostForm("admin/structure/types/manage/$type/translate/$langcode/add", $edit, t('Save translation')); + + // Check the name is translated without admin theme for editing. + $this->drupalPostForm('admin/appearance', array('use_admin_theme' => '0'), t('Save configuration')); + $this->drupalGet("$langcode/node/add/$type"); + $this->assertRaw(t('Create @name', array('@name' => $translated_name))); + + // Check the name is translated with admin theme for editing. + $this->drupalPostForm('admin/appearance', array('use_admin_theme' => '1'), t('Save configuration')); + $this->drupalGet("$langcode/node/add/$type"); + $this->assertRaw(t('Create @name', array('@name' => $translated_name))); + } + + /** * Tests date format translation. */ public function testDateFormatTranslation() { diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php index 6ee2017..4eb7bd8 100644 --- a/core/modules/node/src/Controller/NodeController.php +++ b/core/modules/node/src/Controller/NodeController.php @@ -243,7 +243,11 @@ public function revisionOverview(NodeInterface $node) { * The page title. */ public function addPageTitle(NodeTypeInterface $node_type) { - return $this->t('Create @name', array('@name' => $node_type->name)); + $translated_name = $this->entityManager() + ->getStorage('node_type') + ->load($node_type->id()) + ->label(); + return $this->t('Create @name', array('@name' => $translated_name)); } }