Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

I18n: interpolation does not conform to documented behaviour

#3415

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).

Reported by Lukas Spee · October 22nd, 2009 @ 07:03 PM

State: resolved
Milestone: none
Assigned to: Sven Fuchs Sven Fuchs
Importance: none

Activity

  1. Lukas Spee
    Lukas Spee
    • Tag changed from edge, i, i18n, patch to edge, i18n, patch

    October 22nd, 2009 @ 07:33 PM

  2. thedarkone
    thedarkone

    Hey Lukas,

    I think this has already been fixed in the edge version of I18n library:

    http://github.com/svenfuchs/i18n

    October 23rd, 2009 @ 12:13 AM

  3. Lukas Spee
    Lukas Spee

    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.

    October 25th, 2009 @ 10:24 AM

  4. José Valim
    José Valim
    • 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!

    February 3rd, 2010 @ 10:03 AM