I18n for labels of type :boolean as: :radio_buttons

434 views
Skip to first unread message

Adam Spooner

unread,
Nov 27, 2013, 2:05:18 PM11/27/13
to plataformate...@googlegroups.com
Is there a way to add internationalizations for the "Yes" and "No" labels created when displaying a boolean as radio buttons?

I've tried this in my simple_form.en.yml (substituting model_name and attribute_name):

en:
  simple_form:
    labels:
      model_name:
        attribute_name:
          true: 'Yay'
          false: 'Nay'

And this:

en:
  simple_form:
    labels:
      model_name:
        attribute_name:
          attribute_name_true: 'Yay'
          attribute_name_false: 'Nay'

And this:

en:
  simple_form:
    labels:
      model_name:
        attribute_name_attribute_name_true: 'Yay'
        attribute_name_attribute_name_false: 'Nay'

And I've tried all three of the variations above under:

en:
  simple_form:
    options:

Thanks for the help,
Adam

Vasiliy Ermolovich

unread,
Nov 27, 2013, 3:36:41 PM11/27/13
to plataformate...@googlegroups.com
IIRC it should be "true": 'Yay' (with quotes). The same for "false".

Adam Spooner wrote:
--
You received this message because you are subscribed to the Google
Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to plataformatec-simp...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Adam Spooner

unread,
Nov 27, 2013, 4:42:35 PM11/27/13
to plataformate...@googlegroups.com
Thanks, Vasiliy. I tried each variation wrapping "true" and "false" in quotation marks, but nothing worked.

Any other advice?

Vasiliy Ermolovich

unread,
Nov 27, 2013, 5:25:32 PM11/27/13
to plataformate...@googlegroups.com
Oh, now I remember. Simple Form generates simple_for.yml file with this translations for you https://github.com/plataformatec/simple_form/blob/master/lib/generators/simple_form/templates/config/locales/simple_form.en.yml#L3. So as you can see something like

en:
simple_form:
   "yes": 'Yay'
   "no": 'Ney'

should work.

Adam Spooner wrote:

Thanks, Vasiliy. I tried each variation wrapping "true" and "false" in
quotation marks, but nothing worked.

Any other advice?

On Nov 27, 2013, at 15:36, Vasiliy Ermolovich <you...@gmail.com
<mailto:you...@gmail.com>> wrote:


For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google
Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to
plataformatec-simp...@googlegroups.com

For more options, visit https://groups.google.com/groups/opt_out.

Adam Spooner

unread,
Nov 27, 2013, 6:01:24 PM11/27/13
to plataformate...@googlegroups.com
Awesome. Worked like a charm. Thanks, Vasiliy!
Reply all
Reply to author
Forward
0 new messages