Issue Feature Closed

#106640Site settings definition: Allow localization of enum labels

Uwe Wiebach 04/30/25, 11:34 updated 03/07/26, 23:03

Description

It is possible to localize labels in site settings definitions, but not the labels of an enum. They are always treated as a string…

I would like to see that something like this is possible:

setting.option:
  # localized setting label - works already
  label: 'LLL:EXT:example/Resources/Private/Language/locallang.xlf:setting.option'
  category: Category
  type: string
  enum:
    option1: 'LLL:EXT:example/Resources/Private/Language/locallang.xlf:setting.option.1' # localized enum label - does not work!
    option2: 'LLL:EXT:example/Resources/Private/Language/locallang.xlf:setting.option.2'
  default: 'option2'

Reviews 2

History 612

  1. Eric Harrer commented and changed target version Tags settings, definition, enum, label, language, localization <span data-processor="relativetime" data-value="2025-09-25T08:32:31+00:00" > 09/25/25, 08:32 </span>

    We currently have the following identifiers available in Configuration/Sets/<SITE_SET_IDENTIFIER>/labels.xlf :

    • Label-Identifier: settings.<SETTING_IDENTIFIER>
    • Description-Identifier: settings.description.<SETTING_IDENTIFIER>

    It would be great if there were also a standardised label identifier for enums instead of the LLL notation.

    I would like the following spelling, for example:

    • Enum-Item-Label-Identifier: settings.<SETTING_IDENTIFIER>.enum.<ITEM_VALUE>

    Example:

    Configuration/Sets/<site_set_identifier>/settings.definitions.yaml:</site_set_identifier>

    settings:
      styles.content.textmedia.mobileGalleryAlignment:
        default: 'center'
        type: string
        enum:
          - flex-start
          - center
          - flex-end
          - space-between
          - space-around
          - space-evenly
        category: fsc.content

    Configuration/Sets/<site_set_identifier>/labels.xlf:</site_set_identifier>

    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment">
        <source>Mobile gallery alignment</source>
    </trans-unit>
    <trans-unit id="settings.description.styles.content.textmedia.mobileGalleryAlignment">
        <source>Defines the `justify-content` value for `.ce-row` when images are displayed above or below the text (mobile stacking). Possible values are `flex-start`, `center` (default), `flex-end`, `space-between`, `space-around`, or `space-evenly`.</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.flex-start">
        <source>Align items at the start of the row</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.center">
        <source>Center items in the row (default)</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.flex-end">
        <source>Align items at the end of the row</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.space-between">
        <source>Distribute items with space between</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.space-around">
        <source>Distribute items with space around</source>
    </trans-unit>
    <trans-unit id="settings.styles.content.textmedia.mobileGalleryAlignment.enum.space-evenly">
        <source>Distribute items with equal space around</source>
    </trans-unit>
  2. Eric Harrer commented <span data-processor="relativetime" data-value="2026-02-19T15:09:22+00:00" > 02/19/26, 15:09 </span>

    I revisited my earlier approach with a closer look at the current Core internals and would suggest the following combined strategy:

    • Keep explicit enum labels in settings.definitions.yaml as an override (including direct LLL: usage).
    • Add a standardized auto-key pattern for enum labels in labels.xlf:
      • settings.enum.<settingKey>.<enumValue>
    • Use a deterministic fallback chain:
      1. explicit enum label if it is an LLL: reference
      2. derived key settings.enum.<settingKey>.<enumValue>
      3. literal enum label from YAML
      4. enum value itself (last fallback)

    This keeps the feature backward-compatible while aligning with existing site settings key logic (settings.* and settings.description.*).

    From an integrator perspective this provides both worlds:
    • convention-based localization via labels.xlf
    • explicit LLL: labels when fine-grained control is needed
  3. Eric Harrer commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-03-02T19:25:10+00:00" > 03/02/26, 19:25 </span>

    Applied in changeset commit:22342ce547fdb5a44fdabd62e05e3c14db6e8f8b.

  4. Gerrit Code Review pushed patch set 1 for main to change 93041 status Resolved Under Review <span data-processor="relativetime" data-value="2026-03-03T14:15:31+00:00" > 03/03/26, 14:15 </span>

  5. Eric Harrer commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-03-07T23:03:07+00:00" > 03/07/26, 23:03 </span>

    I am closing this as it has been resolved by merged patch:
    https://review.typo3.org/c/Packages/TYPO3.CMS/+/92902