Problem/Motivation
A Choice constraint in config schema lists the values a setting accepts, but there is no way to give those values a human-readable label. The labels are only written in the settings form.
For example, the setting for who can register accounts is defined in user.schema.yml as (trimmed):
register:
type: string
label: 'Who can register accounts?'
constraints:
Choice:
choices:
- 'visitors'
- 'admin_only'
- 'visitors_admin_approval'
While the labels are in AccountSettingsForm:
'#options' => [
UserInterface::REGISTER_ADMINISTRATORS_ONLY => $this->t('Administrators only'),
UserInterface::REGISTER_VISITORS => $this->t('Visitors'),
UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL => $this->t('Visitors, but administrator approval is required'),
],Anything that reads the config schema, like an auto-generated settings form, a front end, a workflow tool like ECA/FlowDrop/Maestro, or an AI agent, has no access to the human-readable labels.
Proposed resolution
Let config schema give each allowed value a label that can be translated. Then every tool shows the same words the settings form shows, in the site's language.
Single Directory Components solved the same problem for component props in #3493070: SDC `enum` props should have translatable labels: use `meta:enum`, so that's a good place to learn from.
Comments