Symfony2 translation of validation messages issue
If you follow this steps, it should work:
First, turn on translation system:
# app/config/config.ymlframework: translator: { fallback: en }
Create the constraint as you did:
// src/AppBundle/Entity/Friend.phpuse Symfony\Component\Validator\Constraints as Assert;// Don't forget this part.class Friend{ /** * @var string * @Assert\NotBlank(message = "test") * @ORM\Column(name="name", type="string", length=255) */ public $name;}
Create a translation file under the validators catalog for the constraint messages, typically in the Resources/translations/ directory of the bundle as you did.
# validators.en.ymltest: my message
IMPORTANT Last, clear your cache as you've added new translations (do it even if you're in dev environment).
$ php app/console cache:clear
For me this solution works.