mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
20 lines
No EOL
529 B
Ruby
20 lines
No EOL
529 B
Ruby
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
|
|
|
|
def localize(*args)
|
|
I18n.localize *args
|
|
end
|
|
end
|
|
end
|
|
end |