Multilanguage support in select box

Y

Yu Co

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

"<td><%=select "customer", "salutation", [ _ 'Mr' , _ 'Ms' ] %></td>"
Unfortunately I get a SyntaxError. If I change this line to
"<td><%=select "customer", "salutation", [ _ 'Mr' ] %></td>"
Then it works fine.

Any suggestions?
 
P

Pit Capitain

Yu said:
Then I want to import these declarations in my rhtml file

"<td><%=select "customer", "salutation", [ _ 'Mr' , _ 'Ms' ] %></td>"
Unfortunately I get a SyntaxError. If I change this line to
"<td><%=select "customer", "salutation", [ _ 'Mr' ] %></td>"
Then it works fine.

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

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

Regards,
Pit
 
Y

Yu Co

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 said:
Yu said:
Then I want to import these declarations in my rhtml file

"<td><%=select "customer", "salutation", [ _ 'Mr' , _ 'Ms' ] %></td>"
Unfortunately I get a SyntaxError. If I change this line to
"<td><%=select "customer", "salutation", [ _ 'Mr' ] %></td>"
Then it works fine.

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

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

Regards,
Pit
 
Y

Yu Co

Pit said:
Yu said:
Then I want to import these declarations in my rhtml file

"<td><%=select "customer", "salutation", [ _ 'Mr' , _ 'Ms' ] %></td>"
Unfortunately I get a SyntaxError. If I change this line to
"<td><%=select "customer", "salutation", [ _ 'Mr' ] %></td>"
Then it works fine.

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

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

Regards,
Pit

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top