Base fields across the project declare their allowed_values labels as plain PHP strings, and nothing translates them: OptionsWidgetBase::getOptions() reads the setting and sanitizes it, so the label reaches the select exactly as written. A French site shows "The full price" under a French label and description, and the string is never extracted for translation either, since no translation function ever sees it.

Seventeen option lists are affected, across eight files: the booking state; the resource's booking mode, booking cutoff, lead time unit, refund gate and cancellation deadline unit; the payment collection mode, deposit handling, refund gate and refund deadline unit; the calendar's availability display and selection mode; the manager grant scope; the node display mode; and the ticket switch. The pattern to follow is already in the project: the resource's settlement field and every Kessai state list wrap their labels in TranslatableMarkup.

Fixed by wrapping every option label, and by adding a kernel test that walks the base fields of every yoyaku entity type and fails on any label that is not a TranslatableMarkup, so the next plain string is caught before it ships rather than being noticed on a translated screen.

Note for the release notes: option labels live in the installed field storage definitions, so a site that installed before this change will report those fields as needing an update until it reinstalls. Pre-1.0, so no update hook.

Issue fork yoyaku-3614403

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Title: Payment field options are not translatable » Select option labels are declared as plain strings, so they are never translated
Issue summary: View changes
Status: Active » Needs review

  • mably committed 39bd4f0d on 1.x
    fix: #3614403 Select option labels are declared as plain strings, so...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Merged to 1.x as 39bd4f0.

The fix went wider than the title first said, which is why the issue was rewritten: the same plain-string labels were in seventeen option lists across six modules, not just the two payment fields. OptionLabelsTranslatableTest now walks the base fields of every yoyaku entity type, so a new plain string fails a test rather than reaching a translated screen.

One correction to the note above about the release notes: no field update is needed after all. Core flags a field only when its storage schema changes, and an option label does not affect the schema, so an existing site picks the translated labels up with nothing more than a cache rebuild.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.