Rails 3 Model attributes localization

I am trying to localize in Rails 3, and I don’t understand the change
w Rails 2 …

I wrote the following hierarchy :

en:
model:
user: User
attributes:
login: Login
email: Email
password: Password
roles: Roles

and tried to use in my view I18n.t(‘user.roles’) to get the
localization of roles
but cannot find it : translation missing: fr, user, roles

In rails 2 I had to stipulate activerecord: should I do it also w
Rails 3 ?

thansk for your feedback

2010/9/24 Erwin [email protected]

 email: Email
 password: Password
 roles: Roles

and tried to use in my view I18n.t(‘user.roles’) to get the
localization of roles
but cannot find it : translation missing: fr, user, roles

I think you don’t have to indent attributes in model. Try this:

en:
model:
user: User
attributes:
user:
login: Login
email: Email
password: Password
roles: Roles

On Fri, Sep 24, 2010 at 19:22, Erwin [email protected] wrote:

 email: Email
 password: Password
 roles: Roles

and tried to use in my view I18n.t(‘user.roles’) to get the
localization of roles
but cannot find it : translation missing: fr, user, roles

In rails 2 I had to stipulate activerecord: should I do it also w
Rails 3 ?

Haven’t used Rails 3 myself. Just try it and see, though. I would
guess you need to put the translation in
activerecord.attributes.user.roles.

Once you use that convention, you can do
User.human_attribute_name(:roles) instead of
I18n.t(“activerecord.attributes.user.roles”). Assuming that didn’t
change from Rails 2.

Thanks Henrik , no change in Rails 3
easier mgt of form labels however…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs