Multilanguage support in select box

Hi all,

I want to add multilanguage support in a select box. There is a file
with all the translations. The entries look like

"

l.store “Mr”, “Herr”
l.store “Ms”, “Frau”

"

Then I want to import these declarations in my rhtml file

<%=select “customer”, “salutation”, [ _ ‘Mr’ , _ ‘Ms’ ] %>”
Unfortunately I get a SyntaxError. If I change this line to
“<%=select “customer”, “salutation”, [ _ ‘Mr’ ] %>”
Then it works fine.

Any suggestions?

Yu Co schrieb:

Then I want to import these declarations in my rhtml file

<%=select “customer”, “salutation”, [ _ ‘Mr’ , _ ‘Ms’ ] %>”
Unfortunately I get a SyntaxError. If I change this line to
“<%=select “customer”, “salutation”, [ _ ‘Mr’ ] %>”
Then it works fine.

You have to add parentheses to tell Ruby where the argument lists end:

<%= select "customer", "salutation", [ _('Mr'), _('Ms') ] %>

Regards,
Pit

Hi Pit,

thanks for the answer but unfortunately it didn’t work. The select box
shows “Mr” and “Ms” instead of “Herr” and “Frau”

Pit C. wrote:

Yu Co schrieb:

Then I want to import these declarations in my rhtml file

<%=select “customer”, “salutation”, [ _ ‘Mr’ , _ ‘Ms’ ] %>”
Unfortunately I get a SyntaxError. If I change this line to
“<%=select “customer”, “salutation”, [ _ ‘Mr’ ] %>”
Then it works fine.

You have to add parentheses to tell Ruby where the argument lists end:

<%= select "customer", "salutation", [ _('Mr'), _('Ms') ] %>

Regards,
Pit

Pit C. wrote:

Yu Co schrieb:

Then I want to import these declarations in my rhtml file

<%=select “customer”, “salutation”, [ _ ‘Mr’ , _ ‘Ms’ ] %>”
Unfortunately I get a SyntaxError. If I change this line to
“<%=select “customer”, “salutation”, [ _ ‘Mr’ ] %>”
Then it works fine.

You have to add parentheses to tell Ruby where the argument lists end:

<%= select "customer", "salutation", [ _('Mr'), _('Ms') ] %>

Regards,
Pit

Sorry Pit, your suggestion was correct. I just have need to change to
language setting in the browser, then it works fine.