aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/translation_helper.rb
blob: c13c2dfc0437f5e194b8091580b970283e8fc6b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'action_view/helpers/tag_helper'

module ActionView
  module Helpers
    module TranslationHelper
      def translate(*args)
        args << args.extract_options!.merge(:raise => true)
        I18n.translate *args

      rescue I18n::MissingTranslationData => e
        keys = I18n.send :normalize_translation_keys, e.locale, e.key, e.options[:scope]
        content_tag('span', keys.join(', '), :class => 'translation_missing')
      end
    end
  end
end