[Rails3] Model.model_name.human not working with ActiveModel::Translation

I am using ActiveModel::Translation, it’s working fine for attributes,
but I cannot get the Model name translated

in the console I get …

Profile.i18n_scope => :mongoid ( I am using Mongodb)
I18n.locale => :en
Profile.human_attribute_name(“first_name”) => “First Name”
Profile.model_name.human => “Profile”

now changing the locale

I18n.locale = :fr => :fr
Profile.human_attribute_name(“first_name”) => “Prnom” ( it works !)
Profile.model_name.human => “Profile” ( it doesn’t work… I should get
“Profil”

==== Model Profile
require ‘active_model’
class Profile
include ActiveModel::AttributeMethods
include ActiveModel::Translation
include ActiveModel::Validations
extend ActiveModel::Naming

==== locale :en
en:
mongoid:
model:
profile: Profile
attributes:
profile:
first_name: First Name

==== locale :fr
fr:
mongoid:
model:
profile: Profil << I should get it !!!
attributes:
profile:
first_name: Prnom << I get it !!

what could be wrong ? I could not find any similar errors in
Google …

strange, if I ask Model.human_name in the console, I don’t get the
deprecated message …

Profile.human_name => “Profile”

thanks for your suggestions

mongoid:
models:
profile: Profile

model should be in plural form.

Thanks Konstantin … you just confirmed what I finally found looking
into lib/active_model/naming.rb

=> options.reverse_merge! :scope =>
[@klass.i18n_scope, :models], :count => 1, :default => defaults

so I modified my locale files , and I was coming back here to mention
it… and read your answer … !! thanks again …

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