How to translate active record model validations

前端 未结 3 1867
[愿得一人]
[愿得一人] 2021-02-01 03:05

When I submit a form with an error in it, it returns an error message. How can I translate these error messages with i18n? I already have translation for all the other texts in

3条回答
  •  孤独总比滥情好
    2021-02-01 03:37

    Just use the Dutch translations file that you can find here. It contains translations for most (if not all) ActiveRecord validation messages.

    Copy the file to config/locales/ in your project.

    Alternate method

    If you want to benefit from updated translations, add the following to your Gemfile instead of copying the translation files by hand:

    gem 'rails-i18n'
    

提交回复
热议问题