Created
November 21, 2010 04:55
-
-
Save chrisk/708470 to your computer and use it in GitHub Desktop.
Workaround for Remarkable's deprecated I18n interpolation syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!