diff options
author | Xavier Noria <fxn@hashref.com> | 2010-05-04 19:36:26 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-05-04 19:36:26 +0200 |
commit | 583b60d109522907020700225f1c739737297a2d (patch) | |
tree | a36d986cbbb73c94d217cbe86c9af7ef97a89567 /actionpack/lib/action_view/helpers/translation_helper.rb | |
parent | 44a98967676492995d19fd4d541dbc9d52bf6b53 (diff) | |
parent | 0dd3b4630fea4bd4d4010b7096c9ee79d34c4501 (diff) | |
download | rails-583b60d109522907020700225f1c739737297a2d.tar.gz rails-583b60d109522907020700225f1c739737297a2d.tar.bz2 rails-583b60d109522907020700225f1c739737297a2d.zip |
Merge remote branch 'rails/master'
Diffstat (limited to 'actionpack/lib/action_view/helpers/translation_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/translation_helper.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/helpers/translation_helper.rb b/actionpack/lib/action_view/helpers/translation_helper.rb index 89c1b4a275..086ad261c8 100644 --- a/actionpack/lib/action_view/helpers/translation_helper.rb +++ b/actionpack/lib/action_view/helpers/translation_helper.rb @@ -20,7 +20,7 @@ module ActionView options[:raise] = true translation = I18n.translate(scope_key_by_partial(key), options) translation = (translation.respond_to?(:join) ? translation.join : translation) - if html_safe_translation_key? key + if html_safe_translation_key?(key) translation.html_safe else translation @@ -53,12 +53,8 @@ module ActionView end def html_safe_translation_key?(key) - last_key = if key.is_a? Array - key.last - else - key.to_s.split('.').last - end - (last_key == "html") || (last_key.ends_with? "_html") + key = key.is_a?(Array) ? key.last : key.to_s + key =~ /(\b|_|\.)html$/ end end end |