Rails internationalization is not working in production mode

丶灬走出姿态 提交于 2019-12-24 18:10:37

问题


I have a non-AR model, which I use for a form/composition object.

There are lots input fields, which I collect in order to do some data manipulation inside AR transaction.

I use I18n for internationalization.

yml:

pl:
  activemodel:
    attributes:
      catalog/checkout:
        name: Imię

form:

= f.input :name,
  required: true,
  label: I18n.t(:'.activemodel.attributes.catalog/checkout.name')

The issue is that in development and production modes (locally) I see the input having proper label taken from config/locales, but on production server it says

"translation missing: pl.activemodel.attributes.catalog/checkout.name"

It happens exclusively with this non-AR model - everywhere else I18n works perfectly fine.

Any thoughts?

EDIT

Logged into the production server's console:

I18n.reload!
#=> nil
I18n.t(:'.activemodel').keys
#=> [:errors, :attributes] # attributes is what wee need

But

I18n.t(:'.activemodel.attributes')
#=> "translation missing: pl.activemodel.attributes" 

Wth?...

EDIT #2

I have to notice, that having

pl:
  activemodel:
    attributes:
      catalog/checkout:
    errors:
      models:
        catalog/checkout:
          attributes:

errors section works as expected, problems are only with activemodel.attributes

来源:https://stackoverflow.com/questions/34083384/rails-internationalization-is-not-working-in-production-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!