How to change validation messages on forms

后端 未结 1 694
一个人的身影
一个人的身影 2021-02-10 16:12

the website I\'m developing will be in spanish. Therefore, I\'ll need the error messages in that language.

I created a file under Configuration directory called \'en.yml

1条回答
  •  甜味超标
    2021-02-10 16:45

    You have to specify the translation after the attribute

    es:
      activerecord:
        models:
          announcement: "Anuncio"
        attributes:
          announcement:
            title: "Título"   # <= here
        errors:
          models:
            announcement:
              attributes:
                title:
                  blank: "no puede estar vacío."
    

    See 5.1 Translations for ActiveRecord Models for more information

    0 讨论(0)
提交回复
热议问题