gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 10:13:29 34 4
gpt4 key购买 nike

我正在将一个 Rails 应用程序升级到 2.3.2,我发现我无法显示 ActiveRecord 的默认验证错误消息,因为我没有它的翻译文件。

这是报告的错误:

translation missing: en-US, activerecord, errors, template, header
translation missing: en-US, activerecord, errors, template, body
Email translation missing: en-US, activerecord, errors, 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"

然后我只是在这些之后添加了我的自定义字符串。

关于ruby-on-rails - Active Record 有默认的英文翻译文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/782921/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com