Forum: Rails I18n localizing dates

05c3f39db309047f28628a223a757bec?d=identicon&s=25 Hans Marmolin (marmolin)
on 2010-08-25 10:00
(Received via mailing list)
Hi

How to localize the different methods in e.g. Date ?

Tries to use Date.parse(str) with str in any language.
I have a fix for my current problem, where str is a swedish date of
the form 12 MAJ 1983;  Date.parse(str.gsub('MAJ','MAY'),
  but is there a more generic solution?

How to use the different localzed date format as e.g
date.abbr_month_names ?
Tried I18n.l(Date.today) and
I18n.l(Date.today.strftime("%d %b %Y")) and
I18n.l(y.wday).to_s and
I18n.l(y).wday
but without any success !!

The problem is that I do not understand this part of I18n and the
guides give no information about the more complex use of localize?

Would appreciate any help
5976001c9ebf095c4988855a4e102de5?d=identicon&s=25 Clemens Kofler (Guest)
on 2010-08-25 10:48
(Received via mailing list)
Hi Hans,

you could use my delocalize plugin for that:
http://github.com/clemens/delocalize.

- Clemens

On Aug 25, 2010, at 9:59 AM, Hans Marmolin wrote:

> I18n.l(Date.today.strftime("%d %b %Y")) and
> Phone: +46708371202
> To unsubscribe from this group, send email to rails-i18n+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-i18n?hl=en.
>

Clemens Kofler
http://www.railway.at
clemens@railway.at

railway - welcome aboard!
7e565a1681dc0137f43826aa840686af?d=identicon&s=25 Andrés Mejía (Guest)
on 2010-08-25 17:49
(Received via mailing list)
For the second question:

You pass the :format parameter, like this:

I18n.l(Date.today, :format => :long)

The default available formats are :default, :short and :long but you can
add
more to your locale file:
http://github.com/svenfuchs/rails-i18n/blob/master...
05c3f39db309047f28628a223a757bec?d=identicon&s=25 Hans Marmolin (marmolin)
on 2010-08-25 18:00
(Received via mailing list)
Thanks Clemens
It solved all my problems! Just what I needed.
However the plugin should be listed in the i18n guide

Next I need a plugin for inverse translations if existing ?
There is some suggestions in earlier discussion of this problem, but
as Sven remarked -- these solutions are really hacks
Any news regarding this problem
____________________________________________
Hans Marmolin
St: Larsgatan 50, 58224 Linköping, Sweden
Phone: +46708371202







25 aug 2010 kl. 10.47 skrev Clemens Kofler:
05c3f39db309047f28628a223a757bec?d=identicon&s=25 Hans Marmolin (marmolin)
on 2010-08-25 18:03
(Received via mailing list)
Hi Mejía ¨
Thanks for the suggestions. I now think that I understand this area
better

Regarding Mitchell question
A also use separate html files for longer texts (more than one sentence)
____________________________________________
Hans Marmolin
St: Larsgatan 50, 58224 Linköping, Sweden
Phone: +46708371202







25 aug 2010 kl. 17.48 skrev Andrés Mejía:
This topic is locked and can not be replied to.