Sha256: f906b6c8838c07423a577e1ea16b6db924848bdb6851aa3fc03997a69f14e3d6

Contents?: true

Size: 776 Bytes

Versions: 6

Compression:

Stored size: 776 Bytes

Contents

# Rails 3.2.16 and 4.0.2 introduced a new way of displaying missing translation :
# they now wrap them in a <span> element with useful class and title
#
# https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a

module Localeapp
  module MimicRailsMissingTranslationDisplay

    def self.included(o)
      o.instance_eval do

        alias :old_rails_call :call
        def call(exception, locale, key, options)
          locale, key = old_rails_call(exception, locale, key, options).split(', ')
          "<span class=\"translation_missing\" title=\"translation missing: #{key}\">#{locale}, #{key}</span>".html_safe
        end

      end
    end

  end
end

Localeapp::ExceptionHandler.send(:include, ::Localeapp::MimicRailsMissingTranslationDisplay)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
localeapp-0.9.0 lib/localeapp/rails/mimic_rails_missing_translation_display.rb
localeapp-0.8.1 lib/localeapp/rails/mimic_rails_missing_translation_display.rb
localeapp-0.8.0 lib/localeapp/rails/mimic_rails_missing_translation_display.rb
localeapp-0.7.2 lib/localeapp/rails/mimic_rails_missing_translation_display.rb
localeapp-0.7.1 lib/localeapp/rails/mimic_rails_missing_translation_display.rb
localeapp-0.7.0 lib/localeapp/rails/mimic_rails_missing_translation_display.rb