Review main Ready for review

98216[BUGFIX] Resolve placeholders in Symfony constraint messages

Alexander Schnitzler CR +1 V +1 Normal +183 −6 updated 12/01/26, 00:34

Commit message

Constraints on model properties are wrapped by
ConstraintDecoratingValidator. It built the Symfony validator with
translations disabled and stored the message template, with its
named placeholders rewritten to sprintf placeholders, as error
message. Templates printing {error.message} therefore showed raw
placeholders and both plural forms of a message.

The validator now uses Symfony's built-in translator, which replaces
the placeholders and selects the plural form. Messages stay English;
translating them is a separate step.

The message of an error created from a violation whose message is
not a label reference is the resolved text, and the error has no
arguments anymore. Code that passed error.arguments to its own
translation receives an empty list for such errors. Keeping the
arguments would let Error::render() apply vsprintf() to text that
already contains user input, which breaks on a percent sign.
Messages that are label references are still translated with their
arguments.
Show more Show less

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/16/98216/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/16/98216/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Simon Schaufelberger +1
    • Oliver Klee +1
  • Verified V +1 Needs a vote
    • Simon Schaufelberger +1
    • Oliver Klee +1
    • core-ci +1 CI

Merge conflicts 1

Issues 1

Files 2

Review log 56

  1. Alexander Schnitzler uploaded patch set 1 11/30/26, 13:05

  2. Alexander Schnitzler wrote 11/30/26, 13:05

    Topic set to extbase
  3. Alexander Schnitzler commented on patch set 1 11/30/26, 13:14

  4. core-ci voted on patch set 1 V +1 11/30/26, 13:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/116021

  5. Oliver Klee voted on patch set 1 CR +1 V +1 11/30/26, 14:33

  6. Simon Schaufelberger voted on patch set 1 CR +1 V +1 12/01/26, 00:34