mirror of https://github.com/rails/rails
Speed up I18n helpers in views and add entry to CHANGELOG.
This commit is contained in:
parent
35598db01a
commit
a61a6d206b
|
@ -20,7 +20,7 @@ module ActionView
|
||||||
options[:raise] = true
|
options[:raise] = true
|
||||||
translation = I18n.translate(scope_key_by_partial(key), options)
|
translation = I18n.translate(scope_key_by_partial(key), options)
|
||||||
translation = (translation.respond_to?(:join) ? translation.join : translation)
|
translation = (translation.respond_to?(:join) ? translation.join : translation)
|
||||||
if html_safe_translation_key? key
|
if html_safe_translation_key?(key)
|
||||||
translation.html_safe
|
translation.html_safe
|
||||||
else
|
else
|
||||||
translation
|
translation
|
||||||
|
@ -53,12 +53,8 @@ module ActionView
|
||||||
end
|
end
|
||||||
|
|
||||||
def html_safe_translation_key?(key)
|
def html_safe_translation_key?(key)
|
||||||
last_key = if key.is_a? Array
|
key = key.is_a?(Array) ? key.last : key.to_s
|
||||||
key.last
|
key =~ /(\b|_|\.)html$/
|
||||||
else
|
|
||||||
key.to_s.split('.').last
|
|
||||||
end
|
|
||||||
(last_key == "html") || (last_key.ends_with? "_html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
|
*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]
|
* 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]
|
* Harmonize the caching API and refactor the backends. #4452 [Brian Durand]
|
||||||
|
|
Loading…
Reference in New Issue