1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Change array entries to safe doesn't worth then the array is joined as a string losing the safe property of his entries [#4134 status:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Santiago Pastorino 2010-03-08 19:55:57 -02:00 committed by José Valim
parent 0f504a5646
commit e13c179499

View file

@ -13,7 +13,7 @@ module ActionView
def translate(key, options = {})
options[:raise] = true
translation = I18n.translate(scope_key_by_partial(key), options)
translation.is_a?(Array) ? translation.map { |entry| entry.html_safe } : translation.html_safe
translation.respond_to?(:html_safe) ? translation.html_safe : translation
rescue I18n::MissingTranslationData => e
keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
content_tag('span', keys.join(', '), :class => 'translation_missing')