aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorJuan Broullon <juan.broullon@shopify.com>2018-07-03 11:50:02 -0400
committerJuan Broullon <juan.broullon@shopify.com>2018-07-03 11:50:02 -0400
commit42c353705abf133b76dd989bb477af449db8f9fb (patch)
treef59493fec950b7f5e2f33007fd9ba0c55c6428f6 /actionview/lib
parent242ae67ebe98685464b8f23f527e2102dfc3df88 (diff)
downloadrails-42c353705abf133b76dd989bb477af449db8f9fb.tar.gz
rails-42c353705abf133b76dd989bb477af449db8f9fb.tar.bz2
rails-42c353705abf133b76dd989bb477af449db8f9fb.zip
Add safe html support to arrays of translations
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/translation_helper.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb
index 80cb73d683..1c61d8dd29 100644
--- a/actionview/lib/action_view/helpers/translation_helper.rb
+++ b/actionview/lib/action_view/helpers/translation_helper.rb
@@ -85,8 +85,11 @@ module ActionView
end
end
translation = I18n.translate(scope_key_by_partial(key), html_safe_options.merge(raise: i18n_raise))
-
- translation.respond_to?(:html_safe) ? translation.html_safe : translation
+ if translation.respond_to?(:map)
+ translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }
+ else
+ translation.respond_to?(:html_safe) ? translation.html_safe : translation
+ end
else
I18n.translate(scope_key_by_partial(key), options.merge(raise: i18n_raise))
end