问题
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