1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_view/helpers/translation_helper.rb

20 lines
529 B
Ruby
Raw Normal View History

2008-07-06 13:00:55 -04:00
require 'action_view/helpers/tag_helper'
module ActionView
module Helpers
module TranslationHelper
def translate(*args)
2008-07-06 15:20:02 -04:00
args << args.extract_options!.merge(:raise => true)
I18n.translate *args
2008-07-06 13:00:55 -04:00
rescue I18n::MissingTranslationData => e
2008-07-06 15:20:02 -04:00
keys = I18n.send :normalize_translation_keys, e.locale, e.key, e.options[:scope]
2008-07-06 13:00:55 -04:00
content_tag('span', keys.join(', '), :class => 'translation_missing')
end
2008-07-08 06:37:49 -04:00
def localize(*args)
2008-07-16 14:07:08 -04:00
I18n.localize *args
2008-07-08 06:37:49 -04:00
end
2008-07-06 13:00:55 -04:00
end
end
end