Some (or all?) of the configuration entities in the installation process are created as being unknown language (langcode und), although the text used to create them (image style label, menu title and description) are English. These default created configuration entities should be created with langcode 'en'. (It is not an issue if English is not actually a configured language on the site).

Config entities created in the install process, such as the Tags taxonomy vocabulary specify this properly as in:

  $vocabulary = entity_create('taxonomy_vocabulary', array(
    'name' => st('Tags'),
    'description' => $description,
    'vid' => 'tags',
    'langcode' => language_default()->langcode,
    'help' => $help,

Although the language system defaults to 'en' when there is no language code on a config object, for config entities, the entity system defaults to 'und' (since it cannot really know even if 'en' is available on the site), so when the config is saved for some reason, a missing langcode turns into a 'und' langcode, and that disrupts our assumptions.

Reproduce manually

- Check out
- Go to Admin > Config > Configuration translation
- See how config entities will show up as "Uknown language" while non-entity config will properly default to English

#7 1935000-configuration_entities_und-7.patch9.62 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 52,431 pass(es). View
#7 1935000-diff-5-7.txt668 bytesvijaycs85
#5 1935000-configuration_entities_und-5.patch9.6 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 52,556 pass(es). View
#5 1935000-diff-3-5.txt623 bytesvijaycs85
#3 default-config-langcode-en-3.patch8.99 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [MySQL] 52,549 pass(es), 1 fail(s), and 0 exception(s). View
#2 default-config-langcode-en-2.patch7.97 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [MySQL] 52,562 pass(es). View
default-config-langcode-en.patch10.28 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [MySQL] 52,558 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Gábor Hojtsy’s picture

Issue tags: +sprint

Put on D8MI sprint.

Gábor Hojtsy’s picture

7.97 KB
PASSED: [[SimpleTest]]: [MySQL] 52,562 pass(es). View

Views actually needs a more complete solution, they don't export langcode currently. So removing views exports now. That is handled in #1935022: Add a language selector on views.

Gábor Hojtsy’s picture

8.99 KB
FAILED: [[SimpleTest]]: [MySQL] 52,549 pass(es), 1 fail(s), and 0 exception(s). View

Block and Tour config entities do not export the langcode property (even though block entity shipped .yml files include a langcode). Those need fixing too. Image styles, menus, filter formats, user roles and vocabularies don't specify their own exported properties so they inherit the default behavior where all public properties are exported.

Status: Needs review » Needs work

The last submitted patch, default-config-langcode-en-3.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
623 bytes
9.6 KB
PASSED: [[SimpleTest]]: [MySQL] 52,556 pass(es). View

Updating test case with language code...

dawehner’s picture

+++ b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.phpundefined
@@ -103,6 +103,7 @@ protected function createTests() {
+      'langcode' => 'und',

Shouldn't that use a constant?

vijaycs85’s picture

668 bytes
9.62 KB
PASSED: [[SimpleTest]]: [MySQL] 52,431 pass(es). View

Updating constant.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. This should be ready.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

Gábor Hojtsy’s picture

Issue tags: -sprint

Woot, perfect! This will help tremendously in making configuration translation work.

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