Symfony2: How to translate custom error messages in form types?

后端 未结 4 936
梦谈多话
梦谈多话 2021-02-12 15:41

I need to translate the error messages from my form type. Here is my form Type code:

class ReferFriendType extends AbstractType {

public function buildForm(Form         


        
4条回答
  •  情书的邮戳
    2021-02-12 15:56

    It`s easy, see http://symfony.com/doc/current/book/translation.html#translating-constraint-messages And set default_locale in /app/config/config.yml or play with $this->get('request')->setLocale('ru');

提交回复
热议问题