Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291614

Require `langcode: …` only for simple config that contains translatable values

$
0
0

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

  1. Remove the langcode: en from any fully validatable default simple config without translatable strings
  2. Re-save that simple config
  3. 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 have langcode: <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


Viewing all articles
Browse latest Browse all 291614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>