Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finally remove deprecated interpolation syntax

The interpolation syntax "{{foo}}" has been deprecated since 0.4.0 (8894ee5) and is no being removed. Please use the (Ruby 1.9 native) interplation syntax "%{foo}" instead.
  • Loading branch information...
commit 2d43846d2b2a2e596f30fa58ea1c9ddb2243bb64 1 parent 23c9fef
@svenfuchs authored
Showing with 0 additions and 18 deletions.
  1. +0 −11 lib/i18n/backend/base.rb
  2. +0 −7 lib/i18n/tests/interpolation.rb
View
11 lib/i18n/backend/base.rb
@@ -10,7 +10,6 @@ module Base
RESERVED_KEYS = [:scope, :default, :separator, :resolve, :object, :fallback]
RESERVED_KEYS_PATTERN = /%\{(#{RESERVED_KEYS.join("|")})\}/
- DEPRECATED_INTERPOLATION_SYNTAX_PATTERN = /(\\)?\{\{([^\}]+)\}\}/
# Accepts a list of paths to translation files. Loads translations from
# plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml
@@ -150,16 +149,6 @@ def pluralize(locale, entry, count)
def interpolate(locale, string, values = {})
return string unless string.is_a?(::String) && !values.empty?
- string = string.gsub(DEPRECATED_INTERPOLATION_SYNTAX_PATTERN) do
- escaped, key = $1, $2.to_sym
- if escaped
- "{{#{key}}}"
- else
- warn_syntax_deprecation!(locale, string)
- "%{#{key}}"
- end
- end
-
values.each do |key, value|
value = value.call(values) if interpolate_lambda?(value, string, key)
value = value.to_s unless value.is_a?(::String)
View
7 lib/i18n/tests/interpolation.rb
@@ -54,13 +54,6 @@ module Interpolation
assert_equal 'Hi Yehuda!', interpolate(:interpolate, :name => 'Yehuda')
end
- test "interpolation: works with the deprecated syntax" do
- deprecation = capture(:stderr) do
- assert_equal 'Hi David!', interpolate(:default => 'Hi {{name}}!', :name => 'David')
- end
- assert_match "The {{key}} interpolation syntax in I18n messages is deprecated", deprecation
- end
-
test "interpolation: given the translation is in utf-8 it still works" do
assert_equal 'Häi David!', interpolate(:default => 'Häi %{name}!', :name => 'David')
end
Please sign in to comment.
Something went wrong with that request. Please try again.