# Variables not replaced in yml file :S

**URL:** <https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312>\
**Category:** Rails I18n\
**Created:** [January 5, 2011, 6:00am UTC](https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312 "2011-01-05T06:00:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 5, 2011, 6:00am UTC](https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312/1 "2011-01-05T06:00:43Z")

</div>

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 :

# \<%= I18n.t :home\_welcome2, :test=\>"plop" %\>

and here is my en.yml :

en:  
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 🙂

---

<div class="post-metadata">

**Author:** ![lilyweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a6a055/32.png) [@lilyweb](https://www.ruby-forum.com/u/lilyweb)\
**Post date:** [January 5, 2011, 9:28am UTC](https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312/2 "2011-01-05T09:28:36Z")

</div>

On Wed, Jan 5, 2011 at 06:00, Lily 🙂 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![lilyweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a6a055/32.png) [@lilyweb](https://www.ruby-forum.com/u/lilyweb)\
**Post date:** [January 5, 2011, 4:22pm UTC](https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312/3 "2011-01-05T16:22:19Z")

</div>

O\_o

It works ! Thanks a lot !

I’m just… puzzled. What can I have changed so this new syntax would be  
required ?

---

<div class="post-metadata">

**Author:** ![lilyweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a6a055/32.png) [@lilyweb](https://www.ruby-forum.com/u/lilyweb)\
**Post date:** [January 5, 2011, 6:42pm UTC](https://www.ruby-forum.com/t/variables-not-replaced-in-yml-file-s/201312/4 "2011-01-05T18:42:22Z")

</div>

Ok, the gem i18n was installed for another project and it doesn’t like  
{{foo}}.
