Forum: Rails I18n very weird "error"

0ca5b49247f2e65cd5b6a18094d5fa2c?d=identicon&s=25 Sara Kilcher (taranaki)
on 2010-02-19 16:47
Hello everyone

I am working on a project and I am quite new to Rails, now I encountered
something very strange in connection with the I18n.

I use the following lines:
    <%= submit_tag t(:yes_label), :name => 'yes' %>
    <%= submit_tag t(:no_label), :name => 'cancel' %>
:yes_label and :no_label are defined in a de.yml and in an en.yml file.
There are many other translations and all of them work.

If I load the page in German everything is correct and the correct
translation is used...

If I load it in English the translation from the yml file is NOT used...
The button says true and false (I have no idea where this comes from,
those words are nowhere to be seen in the en.yml file) instead of Yes
and No.

Does anyone have an idea what the problem could be?

Also when using this code:
    <%= submit_tag t(:yes_label) %>
    <%= link_to t(:no_label), companies_path %>
Instead of giving a button with Yes and a link with No I get something
really curious... Theres a true button and part of a url...
/companies?locale=en
Whereas in the German version I have a Ja button and a Nein link...
0ca5b49247f2e65cd5b6a18094d5fa2c?d=identicon&s=25 Sara Kilcher (taranaki)
on 2010-02-19 17:04
I figured it out....

When I put
no_label: "No"
instead of no_label: No

it worked...

Same with Yes...
9a183854c4b3cade3d5dd067f457ecfe?d=identicon&s=25 Mateo Murphy (Guest)
on 2010-02-19 17:15
(Received via mailing list)
Yes/No, and On/Off are aliases for True/False in YAML, so they need to
be escaped to be used as strings
This topic is locked and can not be replied to.