grosser/gettext_i18n_rails — pull request #83 by rustygeldmacher (2012-11-09 20:41:30+00:00)
Title: Only interpolate strings when asked to

OK, let me see if I can explain this clearly :)

We ran into a problem due to the fact that when GettextRailsI18n::Backend translates a string, it *always* interpolates it by passing a hash to the `%` method of the translated string. We think that this isn't always the desired behavior, and this patch will only cause interpolation to happen when the called intends it to happen by supplying an options hash.

Sometimes, as in the case of Paperclip's `number.human.storage_units.format` string , the translated string is a format to be used for other purposes. This format (along with date and time formats) contains something like `%n %u`. However, since this I18n backend would always call `%` on the translated string, we'd get expectations due to the facts that `%n %u` is not a valid interpolation format, though this case is valid for localization purposes.

Another case that would generate an error is if the translated string contains a date/time format such as `%Y-%m-%d %H:%M%S`.

Thanks!