Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Problem when using the Form component standalone #4588

Copy link
Copy link
Closed
@fabpot

Description

@fabpot
Issue body actions

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.