1
votes

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] %>
2

2 Answers

0
votes

There are 3 possible problems according to my experiences.

  1. because you have conflict key name in your YAML file. https://i.stack.imgur.com/0kIMr.png. Just remove the conflict key.

  2. if step 1 it doesn't work add the following line to your en.yml file. and make sure that you don't has conflict key name in Yaml file. https://i.stack.imgur.com/U2Url.png

  3. The final step is go to your other [locale].yml. In this case I want to translate to "Khmer" language, so I will go to my "kh.yml" and paste this line of code: https://i.stack.imgur.com/A6I5s.png

If you follow my step carefully I guarantee it will working.

I hope this will help you.