[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Multilanguage support in select box

Yu Co

10/5/2006 4:23:00 AM

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?


--
Posted via http://www.ruby-....

3 Answers

Pit Capitain

10/5/2006 7:23:00 AM

0

Yu Co schrieb:
> 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

Yu Co

10/5/2006 8:28:00 AM

0

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 Capitain wrote:
> Yu Co schrieb:
>> 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


--
Posted via http://www.ruby-....

Yu Co

10/5/2006 12:03:00 PM

0

Pit Capitain wrote:
> Yu Co schrieb:
>> 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.

--
Posted via http://www.ruby-....