Description
As of 345981f, it is not possible to use the Form component standalone.
If you have an error for a choice, min length, or max length constraint, you will get an exception.
That's because the Twig templates are using the trans
and transchoice
functions according to the type of error messages (a plural message or not).
For the choice, min length, and max length validators, the pluralization is enabled but the default message in the validator class does not follow the convention of plural messages (there is a single message and not different messages separated with a |
). It does not follow this convention so that you can use the Validator component as a standalone component without the need to use the Translation component.
Everything works fine in Symfony as we are always using the translation components with the translations the come with the framework bundle. And in the translations for English, we have the right message.
I don't see many options to fix this issue. One of them would be to move the translations from the framework bundle to the twig bridge, so that you can load the translations when using the components standalone. The only downside is that the translations are also required when you are using the PHP templating system, and for that you would need the Twig bridge (but frankly I don't really care about that as this is probably more and more an edge case than anything else).
Any other idea?