aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/translation_helper.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-02-18 22:33:24 -0200
committerYehuda Katz <yehudakatz@YK.local>2010-02-18 16:41:00 -0800
commitaf05420d6bf7cb1c337e95f9941e7db30c521d31 (patch)
tree1baaf612cd55ad5b1f3f13713907fbd6f3a2ab1d /actionpack/lib/action_view/helpers/translation_helper.rb
parentae8c384e2c07da4870dd3919321a6d49aeff3588 (diff)
downloadrails-af05420d6bf7cb1c337e95f9941e7db30c521d31.tar.gz
rails-af05420d6bf7cb1c337e95f9941e7db30c521d31.tar.bz2
rails-af05420d6bf7cb1c337e95f9941e7db30c521d31.zip
i18n translate with arrays issue solved
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
Diffstat (limited to 'actionpack/lib/action_view/helpers/translation_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/translation_helper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/translation_helper.rb b/actionpack/lib/action_view/helpers/translation_helper.rb
index c348ea7a0d..a42e5542f2 100644
--- a/actionpack/lib/action_view/helpers/translation_helper.rb
+++ b/actionpack/lib/action_view/helpers/translation_helper.rb
@@ -12,7 +12,8 @@ module ActionView
# prepend the key with a period, nothing is converted.
def translate(key, options = {})
options[:raise] = true
- I18n.translate(scope_key_by_partial(key), options).html_safe
+ translation = I18n.translate(scope_key_by_partial(key), options)
+ translation.is_a?(Array) ? translation.map { |entry| entry.html_safe } : translation.html_safe
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')
@@ -40,4 +41,4 @@ module ActionView
end
end
end
-end \ No newline at end of file
+end