Re: Windows Locales

[email protected] ("David E. Wheeler")
Newsgroups perl.datetime
Message-ID <[email protected]>
On Aug 27, 2012, at 2:29 PM, Dave Rolsky wrote:

> I'm not sure why you think this would work on Linux either. On my system here's what I get:
> 
>  perl  -MPOSIX -E 'say POSIX::setlocale(POSIX::LC_TIME())'
>  en_US.UTF-8

Yeah, me too.

> That locale will not make DateTime::Locale happy either.

Seems okay with it:

> perl -MDateTime -MPOSIX -E 'my $dt = DateTime->now; $dt->set(locale => POSIX::setlocale( POSIX::LC_TIME() ) ); say $dt->locale'
DateTime::Locale::en_US=HASH(0x7fc90a297dd8)

> Of course, this one's relatively easy to make into something DateTime can handle, whereas the Windows one is _way_ off. Either way, I think you may need to rethink how you translate the user's locale for DateTime.
> 
> I'm not really sure what the best way to do it is besides presenting users with an explicit choice.
> 
> With Windows, someone might want to maintain a master translation list of Windows names to CLDR names, much like we currently translate timezone names.

I found Win32::Locale, which seems to do what I need it to.

Best,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.