Reputation: 5148
en:
activemodel:
attributes:
firm:
status:
active: active
trial: trial
trial-expired: trial is expired
delinquent: delinquent
inactive: inactive
In my config/locals/en.yml I have the following to override the value of firm.status with what is in the language file but I am getting this error:
translation missing: en.trial
Upvotes: 2
Views: 1342
Reputation: 7403
It looks like in your view, you're calling I18N.translate(@firm.status)
(okay, you're probably just calling t @firm.status
, because it looks prettier, right?)
In this case, since the status is "trial", it's the same as calling t "trial"
, which is why it's looking for a top-level translation "en.trial". If you want to namespace this, the simplest way would be to just call t "activemodel.attributes.firm.status.#{@firm.status}"
, although this will quickly get annoying and you'll want some helper methods to do this for you. I'm also not convinced that you should have "activemodel.attributes" as part of the scope.
Consider reading up on http://guides.rubyonrails.org/i18n.html, particularly section 4.1.1 about scopes and 3.5 about organizing your locale files.
Upvotes: 2