Search code examples
ruby-on-railsdatetimemonthcalendardatetime-select

Rails datetime_select month names not showing internationalization


I am having a problem with datetime_select month rails view control.

After integrating new localization to my website (bs_BA) Bosnian, I have a problem where names of months not showing correctly.

enter image description here

This is my view control with slim syntax:

= f.datetime_select :event_date, :order => [:day,:month,:year], class:'form-control'

Also I have a gem 'rails-i18n' installed.

All other label translations are okay, just having issue with 'month' drop-down content.


Solution

  • This is fix in my case filling bs_BA.yml with:

      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]
    

    enter image description here