Rails 2.3.14 localización para sí/no

I have YAML like so, in /config/locales/defaults/en.yml:

en:
  no_results_found: None Found
  yes: Yes
  no: No
  approve: Approve

And get these results in rails console:

>> helper.t(:no_results_found)
=> "None Found"
>> helper.t(:yes)
=> "<span class=\"translation_missing\">en, yes</span>"
>> helper.t(:no)
=> "<span class=\"translation_missing\">en, no</span>"
>> helper.t(:approve)
=> "Approve"

I've tried renaming yes/no to yes_text, and no_text, and get weirder results:

>> helper.t(:yes_text)
=> true
>> helper.t(:no_text)
=> false

How can I output (in English) yes or no? Keep in mind I define in yaml so I can provide versions in other languages.

preguntado el 31 de julio de 12 a las 15:07

2 Respuestas

Uso:

en:
  'yes': Yes
  'no': No

Respondido 31 Jul 12, 16:07

But how is that translated to Russian or Chinese? - SrDerp

en:
 no_results_found: "None Found"
 result_yes: "Yes"
 result_no: "No"
 approve: "Approve"

Add some prefix with yes: or no: translation variable as it is default in i18n.

Respondido 31 Jul 12, 15:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.