We have this in config/initializers/i18n.rb
:
module I18n
# For MissingTranslationData, fall back to the default locale and then to the last key.
# For other exceptions, use the default_exception_handler.
def self.fallback_exception_handler(exception, locale, key, options)
options ||= {}
if !Rails.env.development? && exception.is_a?(MissingTranslationData)
if locale == self.default_locale
send(:normalize_translation_keys, locale, key, options[:scope]).last.to_s
else
self.t(key, options.merge(:locale => self.default_locale))
end
else
send :default_exception_handler, exception, locale, key, options
end
end
end
I18n.exception_handler = :fallback_exception_handler
Note that it will not fall back in development, by design (so you notice missing translations).
Also, this is a Rails 2 app. I believe the fallback exception handling has changed somewhat in Rails 3.