Forum: Rails I18n Variables not replaced in yml file :S

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
88121bbaff086ad61f10eaad843385b2?d=identicon&s=25 Lily ^_^ (lilyweb)
on 2011-01-05 06:00
Hi there,

I have a problem with the replacement of piece of translations set into
the yml file with dynamic content.

Like, I have this is my view :

<h1><%= I18n.t :home_welcome2, :test=>"plop" %></h1>

and here is my en.yml :

 home_welcome2: "Welcome to my site {{test}}"

Test is not replaced by "plop" anymore, it just displays plainly
{{test}}. It USED to work perfect (this site is under dev) but I really
can't find out what broke it.

- removing everything from the en.yml file BUT the two lines above
doesn't help.
- remove everything in the view but this line, as a test, doesn't help
- tried to replace {{test}} by #{test} but it doesn't help either
(anyway, {{test}} was working before)

Has anyone an idea about what could conflict or make the translation
files not accept parameters ?

This site uses :
Ruby 1.8.7
Rails 2.5.8
I18n gem seems to be 0.5

Thanks to anyone who can help about this :S

By the way, happy new year everyone :)
4a551074ddba4460f95d011c47190d0e?d=identicon&s=25 Henrik --- (malesca)
on 2011-01-05 09:28
(Received via mailing list)
On Wed, Jan 5, 2011 at 06:00, Lily ^_^ <> wrote:
> - tried to replace {{test}} by #{test} but it doesn't help either
> (anyway, {{test}} was working before)

Does %{test} work? I believe that's the new syntax.
88121bbaff086ad61f10eaad843385b2?d=identicon&s=25 Lily ^_^ (lilyweb)
on 2011-01-05 16:22

It works ! Thanks a lot !

I'm just... puzzled. What can I have changed so this new syntax would be
required ?
88121bbaff086ad61f10eaad843385b2?d=identicon&s=25 Lily ^_^ (lilyweb)
on 2011-01-05 18:42
Ok, the gem i18n was installed for another project and it doesn't like
This topic is locked and can not be replied to.