diff options
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/translation_helper.rb | 10 | ||||
-rw-r--r-- | actionview/lib/action_view/railtie.rb | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index 4c4d2c4457..152e1b1211 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -6,7 +6,15 @@ module ActionView # = Action View Translation Helpers module Helpers module TranslationHelper + extend ActiveSupport::Concern + include TagHelper + + included do + mattr_accessor :debug_missing_translation + self.debug_missing_translation = true + end + # Delegates to <tt>I18n#translate</tt> but also performs three additional # functions. # @@ -95,6 +103,8 @@ module ActionView title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(', ') end + return title unless ActionView::Base.debug_missing_translation + content_tag('span', keys.last.to_s.titleize, class: 'translation_missing', title: title) end end diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index e829d86c99..59d869d92d 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -6,6 +6,7 @@ module ActionView class Railtie < Rails::Railtie # :nodoc: config.action_view = ActiveSupport::OrderedOptions.new config.action_view.embed_authenticity_token_in_remote_forms = false + config.action_view.debug_missing_translation = true config.eager_load_namespaces << ActionView |