How to use the I18n fallback features in Rails 3

antpaw picture antpaw · Nov 19, 2010 · Viewed 33.5k times · Source

I am getting an "translation missing" error message from Rails 3:

activerecord:
  notices:
    messages:
      success: 
        create: "Something was created"
    models:
      user:
        success:
          create: "Thanks for registration"

I18n.t("activerecord.notices.models.user.success.create")
# => "Thanks for registration"


I18n.t("activerecord.notices.models.book.success.create") 
# => "translation missing: de, activerecord, notices, models, book, success, create"

I don't know why the book model doesn't get the fallback massage. I have set config.i18n.fallbacks = true.

Answer

raskhadafi picture raskhadafi · Aug 30, 2011

I set in config/application.rb usually

    config.i18n.fallbacks = [:de, :fr, :en]

So you can declare the order of the fallback.

But keep attention in some environments/*.rb the configuration is overwritten.