Skip to content

Fix validator placeholders that never interpolate - #3771

Merged
bobvandevijver merged 2 commits into
bolt:6.1from
Vondry:fix/xliff-placeholder-syntax
Aug 3, 2026
Merged

Fix validator placeholders that never interpolate#3771
bobvandevijver merged 2 commits into
bolt:6.1from
Vondry:fix/xliff-placeholder-syntax

Conversation

@Vondry

@Vondry Vondry commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Second of the PRs splitting up #3753. Independent of the others—it branches from master and touches only <target> text inside four validator catalogues.

This is a bug fix, not a translation update. No translated wording changes anywhere in this PR.

The bug

Symfony's validators register placeholder parameters using names that include spaces:

->setParameter('{{ limit }}', $constraint->max)

The translator performs a literal key lookup when substituting placeholders. As a result, translations containing {{limit}} never match the registered parameter, leaving the raw placeholder visible to the user:

trans('...{{ limit }}...', ['{{ limit }}' => 42])  =>  "... 42 ..."
trans('...{{limit}}...',   ['{{ limit }}' => 42])  =>  "... {{limit}} ..."

What this changes

1. Missing spaces — 67 targets (ea62c96)

Fixes placeholder formatting in:

  • validators.el.xlf (27 occurrences)
  • validators.fr.xlf (40 occurrences)

Every change is simply:

{{x}} → {{ x }}

2. Translated placeholder names — 2 targets (a0f83cf)

Fixes another form of the same issue.

In the Russian and Ukrainian translations of:

"The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}."

the placeholder name itself had been translated to {{суффикс}}. Placeholder names are lookup keys, not translatable text, so interpolation never occurred.

The placeholder has been restored to {{ suffix }}. The surrounding translated prose remains unchanged.

Vondry added 2 commits August 3, 2026 16:57
Symfony's validators register their parameters under the spaced name,
e.g. ->setParameter('{{ limit }}', ...), and the translator substitutes
them with a literal key lookup. A translation containing {{limit}}
therefore never interpolates and the user sees the raw placeholder:

    trans('...{{ limit }}...', ['{{ limit }}' => 42])  =>  "... 42 ..."
    trans('...{{limit}}...',   ['{{ limit }}' => 42])  =>  "... {{limit}} ..."

Adds the missing spaces in 67 targets across the Greek and French
validator catalogues. Only characters inside {{ }} change; the translated
prose is byte-identical, so this needs no language knowledge to review.
The suffix placeholder had been translated along with the surrounding
text, leaving {{суффикс}} in the Russian and Ukrainian versions of
"The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}."

Placeholder names are lookup keys, not translatable content, so this
never interpolated. Restores {{ suffix }} to match the source string;
the Cyrillic prose around it is untouched.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Symfony validator translation placeholder interpolation by normalizing placeholder key formatting in several validators.*.xlf catalogues, so runtime setParameter('{{ limit }}', ...) substitutions match the placeholders in translated strings.

Changes:

  • Normalizes missing-space placeholders (e.g., {{limit}}{{ limit }}) in Greek and French validator catalogues.
  • Restores the non-translatable placeholder key {{ suffix }} in Russian and Ukrainian where it had been translated, preventing interpolation.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
translations/validators.uk.xlf Restores {{ suffix }} placeholder key so Symfony parameters interpolate correctly.
translations/validators.ru.xlf Restores {{ suffix }} placeholder key so Symfony parameters interpolate correctly.
translations/validators.fr.xlf Normalizes placeholder spacing across many validator strings to match Symfony parameter keys.
translations/validators.el.xlf Normalizes placeholder spacing across many validator strings to match Symfony parameter keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<segment>
<source>This value should be equal to {{ compared_value }}.</source>
<target>Cette valeur doit être égale à {{compare_value}}.</target>
<target>Cette valeur doit être égale à {{ compare_value }}.</target>
<segment>
<source>9670078</source>
<target>Cette valeur doit être identique à {{compare_value_type}} {{compare_value}}.</target>
<target>Cette valeur doit être identique à {{ compare_value_type }} {{ compare_value }}.</target>
<segment>
<source>949632c</source>
<target>Cette collection doit contenir au mamaximum {{limit}} élément. | Cette collection doit contenir au mamaximum {{limit}} éléments.</target>
<target>Cette collection doit contenir au mamaximum {{ limit }} élément. | Cette collection doit contenir au mamaximum {{ limit }} éléments.</target>
@bobvandevijver
bobvandevijver merged commit a526188 into bolt:6.1 Aug 3, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants