Feature: #106640 - Localize enum labels in site settings definitions
See forge#106640
Description
Enum option labels in site settings definitions can now be localized consistently.
This applies to all common enum declaration styles:
- List-style enum declarations derive localization keys using
settings.<settingin the set labels file.Key>. enum.<enum Value> - Map-style enum declarations are independent of that key schema: only the configured label value is evaluated.
- Map-style enum declarations with localization references
(
LLL:...) resolve these references. - Map-style enum declarations with literal labels keep these labels as-is.
- Map-style key-only enum entries fall back to the enum value.
- Map-style empty string labels remain empty strings.
Example
List-style enum declaration in settings.definitions.yaml
settings:
my.enumSetting:
type: string
default: optionA
enum:
- optionA
- optionB
Copied!
Matching labels in labels.xlf
<trans-unit id="settings.my.enumSetting.enum.optionA">
<source>Option A (localized)</source>
</trans-unit>
<trans-unit id="settings.my.enumSetting.enum.optionB">
<source>Option B (localized)</source>
</trans-unit>
Copied!
Map-style enum declaration in settings.definitions.yaml
settings:
my.enumSetting:
type: string
default: optionA
enum:
optionA: 'LLL:EXT:my_extension/Configuration/Sets/MySet/labels.xlf:settings.custom.optionA' # Explicit LLL reference
optionB: 'Literal Option B' # Literal label
optionC: # Key-only map-style entry, falls back to enum value "optionC"
optionD: '' # Empty label stays empty
Copied!
Referenced label in labels.xlf
<trans-unit id="settings.custom.optionA">
<source>Option A (localized)</source>
</trans-unit>
Copied!
If you want to work with automatically derived keys in the set
labels. (for example
settings.<setting), omit enum labels in YAML and
use list-style enum declarations.
Impact
Integrators can localize enum options consistently using the same resolution behavior as other setting labels.