Problem
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,
));
taxonomy_vocabulary_save($vocabulary);
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 http://drupal.org/project/config_translation
- 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
Comment | File | Size | Author |
---|---|---|---|
#7 | 1935000-configuration_entities_und-7.patch | 9.62 KB | vijaycs85 |
#7 | 1935000-diff-5-7.txt | 668 bytes | vijaycs85 |
#5 | 1935000-configuration_entities_und-5.patch | 9.6 KB | vijaycs85 |
#5 | 1935000-diff-3-5.txt | 623 bytes | vijaycs85 |
#3 | default-config-langcode-en-3.patch | 8.99 KB | Gábor Hojtsy |
Comments
Comment #1
Gábor HojtsyPut on D8MI sprint.
Comment #2
Gábor HojtsyViews 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.
Comment #3
Gábor HojtsyBlock 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.
Comment #5
vijaycs85Updating test case with language code...
Comment #6
dawehnerShouldn't that use a constant?
Comment #7
vijaycs85Updating constant.
Comment #8
dawehnerThanks. This should be ready.
Comment #9
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks.
Comment #10
Gábor HojtsyWoot, perfect! This will help tremendously in making configuration translation work.