我正在将应用程序的rails应用程序升级到2.3.2,我发现我无法显示ActiveRecord的默认验证错误消息,因为我没有它的转换文件.
这是报告的错误:
translation missing: en-US,activerecord,errors,template,header translation missing: en-US,body Email translation missing: en-US,models,user,attributes,email,taken
有谁知道我在哪里可以找到一个默认的英文翻译文件,其中包含验证可能使用的所有字符串?
解决方法
发生这种情况是因为我的语言环境是“en-US”而不是“en”. activerecord / lib / locale下有翻译文件.我将这些翻译复制到一个新文件en_US.yml中.
"en-US": activerecord: errors: template: body: There were problems with the following fields header: one: 1 error prohibited this {{model}} from being saved other: "{{count}} errors prohibited this {{model}} from being saved" messages: inclusion: "is not included in the list" exclusion: "is reserved" invalid: "is invalid" confirmation: "doesn't match confirmation" accepted: "must be accepted" empty: "can't be empty" blank: "can't be blank" too_long: "is too long (maximum is {{count}} characters)" too_short: "is too short (minimum is {{count}} characters)" wrong_length: "is the wrong length (should be {{count}} characters)" taken: "has already been taken" not_a_number: "is not a number" greater_than: "must be greater than {{count}}" greater_than_or_equal_to: "must be greater than or equal to {{count}}" equal_to: "must be equal to {{count}}" less_than: "must be less than {{count}}" less_than_or_equal_to: "must be less than or equal to {{count}}" odd: "must be odd" even: "must be even"