I want to translate validation messages in symfony2.
address:
- NotBlank: { message: "address.address.not_blank" }
- Length:
min: 10
minMessage: "address.address.min_length"
I want to show min or max limit parameter.
address.address.min_length: Address must be at least %limit% characters length
But this isn't working!
My translation file name is validators.en.yml.
Users getting error message exactly like this. They are not able to see
%limit%
How can i show them limit parameter?
According to the official documentation you should use token:
{{ limit }}
and not
%limit%
Now, if you want to supply some parameters that are not strictly bound for the Length
validator you should probably implement your own validator with translator service as an argument. Then it would be just as easy to use it as Length
inside configuration.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments