akyrho
1
Hi everyone,
I am facing a weird issue with the translation helper.
When i try to display a localized string with 4 variables, here what i
get :
my_string: “We successfully add {{count}} credits available from
{{start_date}} to {{end_date}}. Total : {{total}} EUR”
t(“my_string”, :count => 3, :start_date => “2010-01-01”, :end_date =>
“2010-12-31”, :total => 12)
=> “We successfully add 3 credits available from 2010-01-01 to
2010-12-31. Total : {{total}} EUR”
The point is the fourth (total) variable is not interpreted. I tried
to change my variables’ order but it didn’t change anything.
Thanks per advance for your help
akyrho
2
2010/8/4 Céd’ [email protected]
t(“my_string”, :count => 3, :start_date => “2010-01-01”, :end_date =>
“2010-12-31”, :total => 12)
=> “We successfully add 3 credits available from 2010-01-01 to
2010-12-31. Total : {{total}} EUR”
The point is the fourth (total) variable is not interpreted. I tried
to change my variables’ order but it didn’t change anything.
Thanks per advance for your help
Are you in Rails 3. If yes, you can try to change {{}} by this {%%}
akyrho
3
Unfortunately i’m running rails 2.3.5
Le mercredi 04 août 2010 à 12:07 +0200, Andrés gutiérrez a écrit :
akyrho
4
2010/8/4 Cédric Bousmanne [email protected]
Unfortunately i’m running rails 2.3.5
Le mercredi 04 août 2010 à 12:07 +0200, Andrés gutiérrez a écrit :
Are you in Rails 3. If yes, you can try to change {{}} by this {%%}
Try to print “total” variable in the view:
value of total: <%= total %>
What is the ouput?
akyrho
5
The output is the one i expected
Le mercredi 04 août 2010 à 12:51 +0200, Andrés gutiérrez a écrit :
akyrho
6
2010/8/4 Andrés gutiérrez [email protected]:
Are you in Rails 3. If yes, you can try to change {{}} by this {%%}
Rails version does not matter. i18n version is relevant. Also {{}}
throws deprecation, but still works in latest i18n.
akyrho
7
2010/8/4 Céd’ [email protected]:
t(“my_string”, :count => 3, :start_date => “2010-01-01”, :end_date =>
“2010-12-31”, :total => 12)
=> “We successfully add 3 credits available from 2010-01-01 to
2010-12-31. Total : {{total}} EUR”
Tried with identical case and works for me (Rails 2.3.8 + i18n 0.4.1).
akyrho
8
Absolutely, i tried two or three differents names.
Le mercredi 04 août 2010 à 07:54 -0500, Andrés Mejía a écrit :
akyrho
9
Have you tried changing the variable name? Say, “total_price” instead of
“total”? If that works there might be some strange name conflict
somewhere.
On Wed, Aug 4, 2010 at 7:43 AM, Krzysztof K.
<[email protected]