Updated: Comment 0

Problem/Motivation

When you translate config entities appearing in the route slug they have the wrong language (default aka. en), so they aren't translated.

Proposed resolution

The problem is that the routing system comes before the current language context is resetted, chaning the priority a bit fixes that.
So first the locale config subscriber steps in and resets the current language once the request is available, then the routing system executes its logic and loads the config entity.

Remaining tasks

User interface changes

API changes

Files: 
CommentFileSizeAuthor
#5 config-entity-upcast-default-context-2094797-3.patch3.38 KBwebflo
PASSED: [[SimpleTest]]: [MySQL] 58,733 pass(es).
[ View ]
#2 contact-entity-label-translation-test.patch1.66 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]
#1 config-2094797-1.patch950 bytesdawehner
PASSED: [[SimpleTest]]: [MySQL] 58,524 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new950 bytes
PASSED: [[SimpleTest]]: [MySQL] 58,524 pass(es).
[ View ]

This fixes the problem described in config_translation.

Title:Config entities get the wrong language contextConfig entities upcast from the request always get default language context
Issue tags:+sprint, +language-config
StatusFileSize
new1.66 KB
FAILED: [[SimpleTest]]: [MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]

Here is an untested test only. :D

  1. +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
    @@ -144,6 +144,31 @@ function testConfigTranslation() {
    +    // Enable the contact module.
    +    $this->drupalPostForm('admin/modules', array('modules[Core][contact][enable]' => "1"), t('Save configuration'));
    +    $this->resetAll();

    Can't we simply make contact.module a requirement of the test?

  2. +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
    @@ -144,6 +144,31 @@ function testConfigTranslation() {
    +    // translation. This test ensures the entity loaded from the request
    +    // upcasting will already work.

    I think "work" is not very precise. I would suggest "the entity loaded from the request upcasting has active locale overrides."

  3. +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
    @@ -144,6 +144,31 @@ function testConfigTranslation() {
    +    $this->assertTest($categry_label);

    Typo

Marking needs work for 3. at least.

Just put both patches together. Looks good. Fixed two issues in the test from comment 3.

+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
@@ -144,6 +144,31 @@ function testConfigTranslation() {
+    $this->drupalGet($langcode . '/contact/feedback');
+    $this->assertTest($categry_label);

This page callbacks needs the permission "access site-wide contact form".

Typo in $categry_label

StatusFileSize
new3.38 KB
PASSED: [[SimpleTest]]: [MySQL] 58,733 pass(es).
[ View ]

Ups.

Priority:Normal» Major
Status:Needs review» Reviewed & tested by the community
Issue tags:+blocker

Looks good to me. Let's get this in! Marking blocker for #1952394: Add configuration translation user interface module in core since this fails the perfect tests there :) The fails appeared now because contact was just recently converted to the routing system and upcast in the routing vs. the old menu hook based method.

Priority:Major» Normal
Issue tags:-blocker

Looks good, thanks. The bot can prove me wrong, if it wants, but for humans this is RTBC.

Priority:Normal» Major
Issue tags:+blocker

x-post.

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Issue tags:-sprint

Woot, yay!

Automatically closed -- issue fixed for 2 weeks with no activity.