aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-05-01 22:38:57 +0200
committerJosé Valim <jose.valim@gmail.com>2010-05-01 22:38:57 +0200
commita61a6d206b1d37747c3f907487db4bc0952c7b5a (patch)
tree6ca874e98b563470a9395e049bc2c3969be1bca3
parent35598db01a2d754df96b23c20050c1a96c999c76 (diff)
downloadrails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.tar.gz
rails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.tar.bz2
rails-a61a6d206b1d37747c3f907487db4bc0952c7b5a.zip
Speed up I18n helpers in views and add entry to CHANGELOG.
-rw-r--r--actionpack/lib/action_view/helpers/translation_helper.rb10
-rw-r--r--activesupport/CHANGELOG2
2 files changed, 5 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
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index f24a1b1c6c..0652a20035 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
+* Deprecate {{}} as interpolation syntax for I18n in favor of %{} [José Valim]
+
* Array#to_xml is more powerful and able to handle the same types as Hash#to_xml #4490 [Neeraj Singh]
* Harmonize the caching API and refactor the backends. #4452 [Brian Durand]