internationalization - How to use Rails I18n.t to translate an ActiveRecord attribute? -
In my thoughts config / locales / de.yml is trying to use my active record translations. I thought I was clever using this:
de: activrecord: Features: User: Login: "BenetzerKenung" Comment: "Bemerkungun"
And see me in:
<% = label_tag: login, t ('activerecord.attributes.user.login')%>
But instead of translating value ("Benitzzek"), I'm getting the notorious "translation non: D, activarcrud, property, user, login"
Anyone found this work (Labels is not using the translation plugin (I have to beware of potential side effects), or user. Humanize_attribute_name)? What am I missing? (This works when I use "Active Records 1" or something else from the ActiveCard, so my setup looks OK)
Thanks!
OK, my bad, it works fine. I fell into the YML formatting trap: (
To help you debug on the way, use "script / console" and the following statement: - I18n.locale -> Produce that location Should you want to see - I18n.t ('activerecord.attributes') -> You must add all keys / values to your translation, if not, you have created a formatting error in your YML file or it did not get it
And BTW - The plugin is quite good If you do not have the result of ".human_name" (which uses that plugin), then just come back to I18n.t ('your key')
Comments
Post a Comment