This project is archived and is in readonly mode.
I18n: interpolation does not conform to documented behaviour
Reported by Lukas Spee | October 22nd, 2009 @ 07:03 PM
The behaviour of I18n::Backend::Simple#interpolate is documented as:
interpolate "file {{file}} opened by \{{user}}", :file => 'test.txt', :user => 'Mr. X' # => "file test.txt opened by {{user}}"
its actual behaviour, however, is:
interpolate "file {{file}} opened by \{{user}}", :file => 'test.txt', :user => 'Mr. X' # => "file test.txt opened by user"
(so it removes the curly braces)
This patch makes the method work conform its documentation).
Comments and changes to this ticket
-
Lukas Spee October 22nd, 2009 @ 07:33 PM
- Tag changed from edge, i, i18n, patch to edge, i18n, patch
-
thedarkone October 23rd, 2009 @ 12:13 AM
Hey Lukas,
I think this has already been fixed in the edge version of I18n library:
-
Lukas Spee October 25th, 2009 @ 10:24 AM
Yes, you're right. I didn't check the I18n edge. Then it's just not in the version that is currently shipped with Rails. However, I would still suggest to apply this patch to the edge version of I18n, because it is a bit DRY'er than the current implementation; if the curly braces syntax were to change in the future you would only have to change one line of code.
-
José Valim February 3rd, 2010 @ 10:03 AM
- State changed from new to resolved
Since this was already fixed, I'm marking as resolved.If the patch is still valid and an improvement over the current implementation, please send it to: http://i18n.lighthouseapp.com/projects/14948-rails-i18n
Thanks!
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>