simple_form: I18n "translation missing for en.date.order"

Hi, i think i might have stumbled upon a bug.

I have the following field declaration on a simple_form: <%= f.input :start_date %>

My application is internationalized and i’m getting the following error in that line while rendering the template: undefined method `-’ for “translation missing: en.date.order”:String

The last lines of the stack trace are the following:

actionpack (3.1.0) lib/action_view/helpers/date_helper.rb:651:in select_datetime' actionpack (3.1.0) lib/action_view/helpers/date_helper.rb:979:into_datetime_select_tag’ actionpack (3.1.0) lib/action_view/helpers/date_helper.rb:290:in datetime_select' actionpack (3.1.0) lib/action_view/helpers/date_helper.rb:1035:indatetime_select’ simple_form (1.5.1) lib/simple_form/inputs/date_time_input.rb:5:in input' simple_form (1.5.1) lib/simple_form/components/label_input.rb:11:inlabel_input’ simple_form (1.5.1) lib/simple_form/inputs/base.rb:68:in block in render' simple_form (1.5.1) lib/simple_form/inputs/base.rb:66:ineach’ simple_form (1.5.1) lib/simple_form/inputs/base.rb:66:in render' simple_form (1.5.1) lib/simple_form/form_builder.rb:95:ininput’ app/views/jump_events/_form.html.erb:12:in `block in _app_views_jump_events__form_html_erb__3886609086613822031_70186987996920’

Can you guys give me a hand in figuring out what might be wrong? 😃 Thanks a lot

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

You can try to use

gem 'rails-i18n'

In your Gemfile

It’s a bit outdated but i had the same problem and i’ve found a solution. Maybe someone who will be googling for this error will find this thread. Here is my solution:

I was using custom locale file (pl.yml in my case) and all i needed to do was to add those lines in it:

pl:
  (...)
  date:
    order:
      - :day
      - :month
      - :year
  (...)

Good luck !

I had also problem with ‘month’ drop-down control. It was showing some text not months numbers or names and fix in my case for Bosnian bs_BA localization was:

  date:
    order: [ !ruby/symbol day, !ruby/symbol month, !ruby/symbol year ]
    formats:
      default: "%Y-%m-%d"
      short: "%b %d"
      long: "%B %d, %Y"
    day_names: [Ponedjeljak, Utorak, Srijeda, Cetvrtak, Petak, Subota, Nedjelja]
    #abbr_day_names: [P, U, S, C, Pt, S, N]
    month_names: [~, Januar, Februar, Mart, April, Maj, Juni, Juli, August, Septembar, Oktobar, Novembar, Decembar]
    #abbr_month_names: [~, Jan, Feb, Mar, Apr, Maj, Jun, Jul, Aug, Sep, Okt, Nov, Dec]

Sorry about that … actually i was stupidly overriding the “date” key in my translation file 😃