I have several models grouped in a module like this:
#/app/models/blobs/small_text.rb
class Blobs::SmallText < ActiveRecord::Base
#.. class implementation
end
I would like to set the human class name to “Texte Court” in French :
I18n.locale = "fr"
Blobs::SmallText.model_name.human # should return "Texte Court"
I’m having trouble with the module part of the class definition and how it should be included in locale files. I’ve tried several combinations in my locale files but dit not work. Here are some combinations I’ve tried:
# /config/locales/models/blobs.fr.yml
# first attempt (does not work)
fr:
activerecord:
models:
blobs_small_text: "Texte Court"
# /config/locales/models/blobs.fr.yml
# second attempt(does not work)
fr:
activerecord:
models:
blobs:
small_text: "Texte Court"
Any ideas?
Thanks
D.
Ok. I thing I found the answer. When you don’t know the class key just run in a rails console the following instruction:
Now I can update my locale files accordingly:
So now it works. However, is it just me or this naming convention does not respect the general naming conventions in Ruby on Rails?