#111687Messages of Symfony constraints show raw placeholders and both plural forms
Description
Symfony constraints on model properties (#106945) are wrapped by ConstraintDecoratingValidator. It rewrites the named placeholders of the message template to sprintf placeholders and stores the result as the error message, with the values as separate arguments. The validator is built with translations disabled, so the plural forms of a template are not resolved either.
A template that prints {error.message}, as the core templates and most extension templates do, therefore shows for #[Assert\Length(max: 10)]:
This value is too long. It should have %2$s character or less.|This value is too long. It should have %2$s characters or less.
Expected:
This value is too long. It should have 10 characters or less.
Only messages that are label references are translated with their arguments.
The message of an error created from a constraint violation should have its placeholders replaced and its plural form selected.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98216 status
NewUnder Review 11/30/26, 13:05