Rails国际化不在生产模式下工作
我有一个非AR模型,我用它来表单/组合对象。
有很多输入字段,我收集这些字段是为了在AR事务中进行一些数据操作。
我使用I18n进行国际化。
阳明:
pl: activemodel: attributes: catalog/checkout: name: Imię
形成:
= f.input :name, required: true, label: I18n.t(:'.activemodel.attributes.catalog/checkout.name')
问题是在开发和生产模式(本地)中我看到输入具有从config/locales
获取的适当标签,但在生产服务器上它表示
"translation missing: pl.activemodel.attributes.catalog/checkout.name"
它只发生在这种非AR模型中 – 在其他任何地方I18n工作得非常好。
有什么想法吗?
编辑
登录到生产服务器的控制台:
I18n.reload! #=> nil I18n.t(:'.activemodel').keys #=> [:errors, :attributes] # attributes is what wee need
但
I18n.t(:'.activemodel.attributes') #=> "translation missing: pl.activemodel.attributes"
WTH?…
编辑#2
我必须注意到,有
pl: activemodel: attributes: catalog/checkout: errors: models: catalog/checkout: attributes:
errors
部分按预期工作,问题仅与activemodel.attributes