Problem/Motivation
Context: This was discovered in #3426429: [PP-1] Mark layout_builder.settings fully validatable, because langcode: en
had to be added to the new layout_builder.settings
config for it to pass validation for type: config_object
. @alexpott said it should NOT need langcode
. And then this happened:
Quoting @alexpott from Drupal Slack:
FWIW this is going to lead to something great
Maybe…
Because the real rule around langcode is it is required when the config has translatable data in it.
And maybe we can write a constraint for that
💯
Steps to reproduce
- Remove the
langcode: en
from any fully validatable default simple config without translatable strings - Re-save that simple config
- Expected: success, actual: validation error
Proposed resolution
- ✅ New
LangcodeRequiredIfTranslatableValues
validation constraint. - Discuss whether to consider superfluous
langcode
key-value pairs invalid. - ✅ Update existing default config in core
- ✅ Refine
LocaleConfigManager::updateDefaultConfigLangcodes()
to no longer blindly update ALL shipped config to havelangcode: <default langcode>
. See #5. - Update path + test to add/remove
langcode: …
to existing config objects. See #6.
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
TBD