[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Month, Day etc. names in other languages other than English

Diego

8/15/2008 12:02:00 AM

Hi all,

I was wondering if it was possible to internationalize the constant
month and day names, used by DateTime class (for example), in to
something other than English?

I'm using gettext in a Rails application where I am able to
internationalize most of the application. But in some cases where I
take something like a Time class and represent it with a string, I see
the English names for days and months. "Thu", "Aug" etc.

I /think/ this goes all the way down to Ruby and not Rails, hence my
post here. Any help would be appreciated as to how I can
internationalize this area of my application.

Thanks.

Cheers,
Diego
3 Answers

Siep Korteling

8/15/2008 12:53:00 AM

0

Diego wrote:
> Hi all,
>
> I was wondering if it was possible to internationalize the constant
> month and day names, used by DateTime class (for example), in to
> something other than English?
>
> I'm using gettext in a Rails application where I am able to
> internationalize most of the application. But in some cases where I
> take something like a Time class and represent it with a string, I see
> the English names for days and months. "Thu", "Aug" etc.
>
> I /think/ this goes all the way down to Ruby and not Rails, hence my
> post here. Any help would be appreciated as to how I can
> internationalize this area of my application.
>
> Thanks.
>
> Cheers,
> Diego

If it is a ruby issue, you can override the constants defined in the
Date class. It will earn you a warning: already initialized constant,
but that's just what we mean to do. Using Dutch daynames:

require 'Date'
Date.const_set("DAYNAMES",%w(zondag maandag dinsdag woensdag donderdag
vrijdag zaterdag))
p Date.today.strftime("%A")

Check http://www.ruby-doc.org/stdlib/libdoc/date/rdoc/classes...
for the other constants like MONTHNAMES, ABBR_MONTHNAMES, and
ABBR_DAYNAMES.

hth,

Siep


--
Posted via http://www.ruby-....

Stefan Rusterholz

8/16/2008 2:00:00 AM

0

Siep Korteling wrote:
> If it is a ruby issue, you can override the constants defined in the
> Date class. It will earn you a warning: already initialized constant,
> but that's just what we mean to do. Using Dutch daynames:

Doing so breaks DateTime. E.g. parsing will fail afair. There's probably
more issues.

> require 'Date'

Don't require 'Date', require 'date' instead. Otherwise your apps/libs
will break on case sensitive file systems.

Regards
Stefan Rusterholz ("apeiros")
--
Posted via http://www.ruby-....

william mosco

12/10/2011 11:43:00 PM

0

On Dec 10, 3:41 pm, rfisc...@sonic.net (Ray Fischer) wrote:
> william mosco  <wm5...@gmail.com> wrote:
>
>
>
>
>
> >On Dec 10, 1:32 am, rfisc...@sonic.net (Ray Fischer) wrote:
> >> william mosco  <wm5...@gmail.com> wrote:
>
> >> >On Dec 7, 9:30 pm, rfisc...@sonic.net (Ray Fischer) wrote:
> >> >> william mosco  <wm5...@gmail.com> wrote:
>
> >> >> >On Dec 5, 11:16 pm, rfisc...@sonic.net (Ray Fischer) wrote:
> >> >> >> william mosco  <wm5...@gmail.com> wrote:
> >> >> >> >On Dec 3, 2:22 am, rfisc...@sonic.net (Ray Fischer) wrote:
> >> >> >> >> william mosco  <wm5...@gmail.com> wrote:
> >> >> >> >> >On Nov 30, 2:15 am, rfisc...@sonic.net (Ray Fischer) wrote:
> >> >> >> >> >> william mosco  <wm5...@gmail.com> wrote:
> >> >> >> >> >> >On Nov 24, 4:23 am, "james g. keegan jr." <jgkee...@gmail.com> wrote:
> >> >> >> >> >> >> In article
> >> >> >> >> >> >> <1966f0fe-7bd1-4f71-b9db-dd841e1e3...@e2g2000vbb.googlegroups.com>,
>
> >> >> >> >> >> >>  Dino <whate...@homemail.com> wrote:
> >> >> >> >> >> >> > Is Gingrich out of his mind???
>
> >> >> >> >> >> >> there seems to be a very clear consensus that he is, bobby.
>
> >> >> >> >> >> >i see no issue with kids under 14 getting part time work cleaning a
> >> >> >> >> >> >school or a library.
>
> >> >> >> >> >> Make them pay taxes so that your rich masters won't have to.
>
> >> >> >> >> >ray argues against kids learning a work ethic.
>
> >> >> >> >> Asshole, your habit of resorting to stupid lies really shows you to be
> >> >> >> >> nothing more than a bitter dumbass with no clue.
>
> >> >> >> >you came in with no point,
>
> >> >> >> Quit lying, little dictator.  The point is clear to anybody with brains.
> >> >> >> You're so corrupt and evil that you expect children to work for the rich.
>
> >> >> >would you prefer they work for poor people?
>
> >> >> How about "not work", dumbshit?
>
> >> >how 'bout letting them and their parents have the option, dumbshit?
>
> >> And while you're at it you can make slavery legal again too.
>
> >ray demonstrates his ignorance of the constitution.
>
> 98.9% on the irony meter.

really... so if you're aware of the 13th amendment, why would you
make such a stupid comment?