Rails: Nested model name not translated with i18n?
我查看了很多 stackoverflow 问题以找到解决方案,其中对如何正确编写 yml 文件以确保正确翻译嵌套属性的错误消息有不同的描述。
对我来说属性不是问题,模型名称是问题。
一家公司有_许多签署人。我为此写了一条消息:
但是,由于 full_message 方法构建它的方式,我的消息看起来像:
"签字人签字人应至少有一名授权签字人"
我在 en.yml 中尝试了多种变体,如下所示。关于确保模型名称被翻译的结构的任何想法?
1 2 3 4 5 6 7 8 9 10 11 12 | en: activerecord: models: user: User company: Company company/signatory: #This seems good for attributes, but not for the model name one: Signatory other: Signatories party: Party signatory: one: Signatory #This is correct for the model name, but doesn't help with error messages other: Signatories ``` |
下面的呢?
1 2 3 4 5 6 7 8 9 10 11 12 | en: activerecord: models: company: Company signatory: one: Signatory other: Signatories attributes: company: signatory: one: Signatory other: Signatories |
来自文档