Permalink
Browse files

Stop messing with supposedly-deprecated interpolation placeholders wh…

…en no interpolation values have been passed.

[#2885 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 6cbcfff commit bf00de03dee5fba0b53f0fc1bb19464422550aa9 Sven Fuchs committed with jeremy Jul 8, 2009
@@ -10,7 +10,7 @@ class Simple
protected
def interpolate_with_deprecated_syntax(locale, string, values = {})
- return string unless string.is_a?(String)
+ return string unless string.is_a?(String) && !values.empty?
string = string.gsub(/%d|%s/) do |s|
instead = DEPRECATED_INTERPOLATORS[s]
@@ -53,7 +53,7 @@ def test_percent_s_interpolation_syntax_in_error_messages_still_works
def test_percent_s_interpolation_syntax_in_error_messages_is_deprecated
assert_deprecated('using %s in messages') do
- I18n.t :does_not_exist, :default => "%s interpolation syntax is deprected", :value => 'this'
+ I18n.t :does_not_exist, :default => "%s interpolation syntax is deprecated", :value => 'this'
end
end
@@ -70,6 +70,12 @@ def test_percent_d_interpolation_syntax_in_error_messages_is_deprecated
end
end
+ def test_percent_s_interpolation_syntax_not_changed_when_no_values_were_passed
+ assert_not_deprecated do
+ I18n.t :does_not_exist, :default => "%d interpolation syntaxes are deprected"
+ end
+ end
+
# ActiveRecord::Errors
def test_errors_generate_message_translates_custom_model_attribute_key

1 comment on commit bf00de0

You fixed the typo but then added another one :)

Please sign in to comment.