Show translation missing in rails 3 like the rails 2 way

Since I'm using rails 3 there are a lot of translation missing records in production environment because of the way translation missing strings are handled in rails 3, for example the output of translation missing is now :

<span class="translation_missing" title="translation missing: fr.admin.orders_logs.update.title">Title</span>

In our application we see "Title" so we think the translation is ok but infact the translation is missing, if I"m not wrong the displayed text was "translation missing: fr.admin.orders_logs.update.title" in Rails 2.X

How I can activate this again that he shows me the error message instead of putting it just as title in a span?


This seems to be a feature in Rails. See:

A possible fix is to override the culprit by placing something like this to application.rb:

module ActiveModel
  module Translation
    def human_attribute_name(attribute, options = {})
      defaults  = []
      parts     = attribute.to_s.split(".", 2)
      attribute = parts.pop
      namespace = parts.pop

      if namespace
        lookup_ancestors.each do |klass|
          defaults << :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}/#{namespace}.#{attribute}"
        defaults << :"#{self.i18n_scope}.attributes.#{namespace}.#{attribute}"
        lookup_ancestors.each do |klass|
          defaults << :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}"

      defaults << :"attributes.#{attribute}"
      defaults << options.delete(:default) if options[:default]
      defaults << "MISSING TRANSLATION"+defaults.to_yaml # defaults << attribute.humanize

      options.reverse_merge! :count => 1, :default => defaults
      I18n.translate(defaults.shift, options)

Have you tried setting the i18n.fallbacks config to false?

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = false

Need Your Help

How to log to a specific file?

java log4j log4j2

I have a log4j2 logger configuration that basically write all logging of the root logger to a basic logging file. I always use Logger.getRootLogger here.

Error in SQL query when searching

c# mysql sql search

I have an SQL query that displays information from different tables in the database. This query is then displayed in a DataGrid and I have some options in a DropDownList to search through the DataG...