ruby-on-rails – Active Record是否有默认的英文翻译文件?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Active Record是否有默认的英文翻译文件?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在将应用程序的rails应用程序升级到2.3.2,我发现我无法显示ActiveRecord的默认验证错误消息,因为我没有它的转换文件.

这是报告的错误

  1. translation missing: en-US,activerecord,errors,template,header
  2. translation missing: en-US,body
  3. Email translation missing: en-US,models,user,attributes,email,taken

有谁知道我在哪里可以找到一个默认的英文翻译文件,其中包含验证可能使用的所有字符串?

解决方法

发生这种情况是因为我的语言环境是“en-US”而不是“en”. activerecord / lib / locale下有翻译文件.我将这些翻译复制到一个新文件en_US.yml中.
  1. "en-US":
  2. activerecord:
  3. errors:
  4. template:
  5. body: There were problems with the following fields
  6. header:
  7. one: 1 error prohibited this {{model}} from being saved
  8. other: "{{count}} errors prohibited this {{model}} from being saved"
  9. messages:
  10. inclusion: "is not included in the list"
  11. exclusion: "is reserved"
  12. invalid: "is invalid"
  13. confirmation: "doesn't match confirmation"
  14. accepted: "must be accepted"
  15. empty: "can't be empty"
  16. blank: "can't be blank"
  17. too_long: "is too long (maximum is {{count}} characters)"
  18. too_short: "is too short (minimum is {{count}} characters)"
  19. wrong_length: "is the wrong length (should be {{count}} characters)"
  20. taken: "has already been taken"
  21. not_a_number: "is not a number"
  22. greater_than: "must be greater than {{count}}"
  23. greater_than_or_equal_to: "must be greater than or equal to {{count}}"
  24. equal_to: "must be equal to {{count}}"
  25. less_than: "must be less than {{count}}"
  26. less_than_or_equal_to: "must be less than or equal to {{count}}"
  27. odd: "must be odd"
  28. even: "must be even"

然后我在这些之后添加自定义字符串.

猜你在找的Ruby相关文章