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

21 lines
571 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
2008-10-28 11:51:08 -04:00
def translate(key, options = {})
options[:raise] = true
I18n.translate(key, options)
2008-07-06 13:00:55 -04:00
rescue I18n::MissingTranslationData => e
2008-10-28 11:51:08 -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
alias :t :translate
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
alias :l :localize
2008-07-06 13:00:55 -04:00
end
end
end