diff --git a/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleConfigConverter.php b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleConfigConverter.php new file mode 100644 index 0000000..b53e387 --- /dev/null +++ b/core/modules/locale/lib/Drupal/locale/ParamConverter/LocaleConfigConverter.php @@ -0,0 +1,47 @@ +entityManager->getStorageController($entity_type)) { + config_context_enter('config.context.free'); + $entity = $storage->load($value); + config_context_leave(); + return $entity; + } + } + + /** + * Applies if the Route is an admin path. + */ + public function applies($definition, $name, Route $route) { + if (parent::applies($definition, $name, $route)) { + // path_is_admin needs the path without leading "/". + $path = substr($route->getPath(), 1); + return path_is_admin($path); + } + return FALSE; + } + +} diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php index 8fa1ff0..e2ec372 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php @@ -165,6 +165,10 @@ function testConfigTranslation() { // upcasting will already work. $this->drupalGet($langcode . '/contact/feedback'); $this->assertText($category_label); + + // Check if the UI does not show the translated String. + $this->drupalGet('admin/structure/contact/manage/feedback'); + $this->assertFieldById('edit-label', 'Website feedback', 'Translation is not loaded for Edit Form.'); } } diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index f632704..4d71bf8 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -16,3 +16,8 @@ services: tags: - { name: string_translator } - { name: needs_destruction } + paramconverter.locale: + class: Drupal\locale\ParamConverter\LocaleConfigConverter + arguments: ['@entity.manager'] + tags: + - { name: paramconverter, priority: 5 }