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
|