diff options
author | José Valim <jose.valim@gmail.com> | 2010-05-01 22:38:57 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-01 22:38:57 +0200 |
commit | a61a6d206b1d37747c3f907487db4bc0952c7b5a (patch) | |
tree | 6ca874e98b563470a9395e049bc2c3969be1bca3 /actionpack | |
parent | 35598db01a2d754df96b23c20050c1a96c999c76 (diff) | |
download | rails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.tar.gz rails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.tar.bz2 rails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.zip |
Speed up I18n helpers in views and add entry to CHANGELOG.
Diffstat (limited to 'actionpack')
-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 |