Very weird "error"

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…
Whereas in the German version I have a Ja button and a Nein link…

I figured it out…

When I put
no_label: “No”
instead of no_label: No

it worked…

Same with Yes…

Yes/No, and On/Off are aliases for True/False in YAML, so they need to
be escaped to be used as strings

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs