From eb25a33d4e4b47d96101a786903ab820c0b6e08e Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 13 Jan 2015 10:43:13 +0000 Subject: [PATCH] Issue #2137595 by olli, idebr, mitrpaka: 'Create @name' page title uses override-free configuration (eg. not localized) instead of the overridden configuration (eg. localized) --- .../src/Tests/ConfigTranslationUiTest.php | 31 +++++++++++++++++++ core/modules/node/node.routing.yml | 3 ++ 2 files changed, 34 insertions(+) diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index 13bccd7d9dba..5a5f896eb676 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -86,6 +86,9 @@ class ConfigTranslationUiTest extends WebTestBase { 'access contextual links', 'administer views', 'administer account settings', + 'administer themes', + 'bypass node access', + 'administer content types', ] ); // Create and login user. @@ -378,6 +381,34 @@ class ConfigTranslationUiTest extends WebTestBase { $this->assertLinkByHref("$translation_base_url/fr/add"); } + /** + * Tests the node type translation. + */ + public function testNodeTypeTranslation() { + $type = Unicode::strtolower($this->randomMachineName(16)); + $name = $this->randomString(); + $this->drupalLogin($this->adminUser); + $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. */ diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml index 3510669f63ee..2eff2f0e5fdc 100644 --- a/core/modules/node/node.routing.yml +++ b/core/modules/node/node.routing.yml @@ -26,6 +26,9 @@ node.add: _node_add_access: 'node:{node_type}' options: _node_operation_route: TRUE + parameters: + node_type: + use_current_language: TRUE entity.node.preview: path: '/node/preview/{node_preview}/{view_mode_id}'