Skip to content

Instantly share code, notes, and snippets.

@chrisk
Created November 21, 2010 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisk/708470 to your computer and use it in GitHub Desktop.
Save chrisk/708470 to your computer and use it in GitHub Desktop.
Workaround for Remarkable's deprecated I18n interpolation syntax
# The I18n gem included in Rails 2.3.10 deprecates the {{key}} interpolation
# syntax in favor of %{key}, but Remarkable still uses the deprecated syntax.
# This is fixed in https://github.com/remarkable/remarkable/commit/23177b7ddd,
# but not yet released in a gem that's still compatible with Rails 2 and RSpec 1.3.
change_string_values_to_new_syntax = lambda do |key, value|
case value
when String then value.gsub!(I18n::Backend::Base::DEPRECATED_INTERPOLATION_SYNTAX_PATTERN, '%{\2}')
when Hash then value.each_pair(&change_string_values_to_new_syntax)
end
end
I18n.backend.send(:translations)[:en][:remarkable].each_pair(&change_string_values_to_new_syntax)
@ihoka
Copy link

ihoka commented Dec 6, 2010

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment