Search code examples
ruby-on-railstranslationsimple-formrails-i18n

simple_form month translation


I am dealing with a Rails 4 application using simple_form. I want to display the app in spanish so I did I18n.locale = :es. Then I created the labels for simple_form in simple_form.es.yml and everything works all right except for the month dropdown in a birthday field (date attribute). I get this screen:

enter image description here

As you can see in the image, the labels are working right, but the select field kindly tries to say 'translation missing'. I don't know where to add my translation strings. Please help!

I already searched in simple_form documentation and a couple of other posts in SO but found nothing. I am a newbie in translation APIs.

Code behind is just:

<%= f.input :birthday, as: :date, start_year: Date.today.year, 
    end_year: Date.today.year - 120, order: [:day, :month, :year] %>

Solution

  • You must have the locale configured in simple-form.[locale].yaml

    Useful links:

    https://github.com/plataformatec/simple_form/issues/695#issuecomment-10495237

    https://github.com/rails/rails/blob/v3.2.8/activesupport/lib/active_support/locale/en.yml#L18-L21