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

Android-PullToRefresh frezzes ExpandableListView when refreshing

android github expandablelistview pull-to-refresh

I am trying to integrate Android-PullToRefresh to refresh an ExpandableListView data. but it freezes UI until it I get data from Network and call method "onRefreshComplete()". I am calling webservi...

save canvas as image only visible area

php javascript jquery html5 canvas

i am trying to save an image from canvas after resizing it or adding some effects on it but i am unable to save the visible area of canvas it save full image all the time is there any way i can sav...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.