Basically you are looking for something like Chronic (https://github.com/mojombo/chronic), but for Italien not English?
As far as I know Chronic only supports English, but if you are interested we could work on making it available to multiple languages. I think many Ruby devs would need something similar. On Wednesday, January 4, 2012 11:45:14 AM UTC+1, Ruby-Forum.com User wrote: > > For example I have this translation file: > https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/it.yml > And I've set: > I18n.locale = :it > > This works fine: > I18n.localize Time.now -> "Mer 04 Gen 2012, 11:26:17 +0100" > "02 Novembre 2012".to_datetime => Fri, 02 Nov 2012 00:00:00 +0000 > > But this gives an invalid date: > "02 Gennaio 2012".to_datetime > > Date::MONTHNAMES returns: > [nil, "January", "February", "March", "April", "May", "June", "July", > "August", "September", "October", "November", "December"] > > The fastest way to solve this problem is to add the months to the YAML > file and translate them into English months. Like this: > Gennaio: January > etc.... > Then I do: > "02 #{I18n.t(Gennaio)} 2012".to_datetime => Mon, 02 Jan 2012 00:00:00 > +0000 > > But I was wondering if there is a more cleaner way so I can get it to > work like this: > "02 Gennaio 2012".to_datetime > > -- > Posted via http://www.ruby-forum.com/. > > -- You received this message because you are subscribed to the Google Groups "rails-i18n" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rails-i18n. For more options, visit https://groups.google.com/groups/opt_out.
