How can I translate ActiveRecord model class name?

What is the simplest way to get translated name of ActiveRecord model class when I have an instance of it?

For example - I have model class like this:

class Category < ActiveRecord::Base
  ...
end

I have an instance of the class:

category = Category.first

And I have YAML file config/locales/cs.yml:

cs:
  activerecord:
    models:
      category: Kategorie

And I need to do this dynamicaly, even when I don't previously know with what model class' instance I will be dealing. So I don't want to explicitly specify "activerecord.models.category".

Is there an easy way to do this? I know, that I can do something like this

"activerecord.models.#{category.class.name.underscore}"

But there has to be a better way to do this.


See:

http://api.rubyonrails.org/classes/ActiveModel/Naming.html http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models

So, for example, on an AR class use:

Person.model_name.human

or from an AR instance:

person.class.model_name.human