Date_select problem with i18n


#1

Hi,
I’m localizing my rails 2.2.2 application using i18n.
In my form(view) I have:
<%= date_select :range,:start_date,:order => [:month,:day,:year]%>
In environment.rb I have:
I18n.default_locale = ‘en-US’
and in en-US.rb its:
I18n.backend.store_translations ‘en-US’,
:date => {
:order => [:month, :day, :year],
:month_names => %w[Jan Feb Mar Apr May Jun Jul Aug Spt Oct Nov Dec]
}

My problem is that the date select options are not proper.
Instead of month names in the drop down I get some 12 numeric
values…!!! as 110,32,111,115…etc…
How should I solve this???
Please help…
Thank You…


#2

Jeba M. wrote:

Hi,
I’m localizing my rails 2.2.2 application using i18n.
In my form(view) I have:
<%= date_select :range,:start_date,:order => [:month,:day,:year]%>
In environment.rb I have:
I18n.default_locale = ‘en-US’
and in en-US.rb its:
I18n.backend.store_translations ‘en-US’,
:date => {
:order => [:month, :day, :year],
:month_names => %w[Jan Feb Mar Apr May Jun Jul Aug Spt Oct Nov Dec]
}

My problem is that the date select options are not proper.
Instead of month names in the drop down I get some 12 numeric
values…!!! as 110,32,111,115…etc…
How should I solve this???
Please help…
Thank You…

Hi Jeba!
I’m using Rails 2.3.2 and I’m developing a simple application with i18n
features. I have put theese lines in a config/locales/fr.yml file:
date:
formats:
default: “%d/%M/%Y”
long: “%e %B %Y”
short: “%d/%M/%y”

order: [ :day, :month, :year ]

month_names: [~, Janvier, Février, Mars, Avril, Mai, Juin, Juillet, 

Août, Septembre, Octobre, Novembre, Décembre]

And my application is working out as I expect. For your information, I
had tried on a first step without defining month_names array and had
same result than you describe.

Good luck!