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
David Heinemeier Hansson 3e54a9a689 A little less hokus pokus
2008-10-28 16:51:08 +01:00

21 lines
No EOL
571 B
Ruby

require 'action_view/helpers/tag_helper'
module ActionView
module Helpers
module TranslationHelper
def translate(key, options = {})
options[:raise] = true
I18n.translate(key, options)
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
alias :t :translate
def localize(*args)
I18n.localize *args
end
alias :l :localize
end
end
end