diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-07-03 18:27:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 18:27:29 +0200 |
commit | a3a876f809cc7f7fde68f6d5c5c8e38132118386 (patch) | |
tree | a14e1c07f8ea66fb8b15115482c6c3ffbc2cc581 /actionview/lib | |
parent | 16d0c74c5b17f6b795cba7e08b7a64a7b4d35ee6 (diff) | |
parent | 42c353705abf133b76dd989bb477af449db8f9fb (diff) | |
download | rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.tar.gz rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.tar.bz2 rails-a3a876f809cc7f7fde68f6d5c5c8e38132118386.zip |
Merge pull request #32361 from ph3t/safe-html-translation-arrays
Add safe html support to arrays of translations
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/translation_helper.rb | 7 |
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 d3cdab0d2f..ba82dcab3e 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -83,8 +83,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 |