# Multilanguage support in select box

**URL:** <https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074>\
**Category:** Ruby\
**Created:** [October 5, 2006, 6:23am UTC](https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074 "2006-10-05T06:23:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yussibaer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e79b87/32.png) [@yussibaer](https://www.ruby-forum.com/u/yussibaer)\
**Post date:** [October 5, 2006, 6:23am UTC](https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074/1 "2006-10-05T06:23:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yussibaer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e79b87/32.png) [@yussibaer](https://www.ruby-forum.com/u/yussibaer)\
**Post date:** [October 5, 2006, 9:24am UTC](https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074/2 "2006-10-05T09:24:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yussibaer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e79b87/32.png) [@yussibaer](https://www.ruby-forum.com/u/yussibaer)\
**Post date:** [October 5, 2006, 10:27am UTC](https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074/3 "2006-10-05T10:27:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yussibaer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e79b87/32.png) [@yussibaer](https://www.ruby-forum.com/u/yussibaer)\
**Post date:** [October 5, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/multilanguage-support-in-select-box/71074/4 "2006-10-05T14:02:56Z")

</div>

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.
