Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > using locales

Reply
Thread Tools

using locales

 
 
garykpdx@hotmail.com
Guest
Posts: n/a
 
      04-20-2005

Is there some sort of tutorial on locales or the locale module?

I can't seem to find a list showing all possible locales. I made 'en'
work alright, but when I tried 'de' or 'de_DE' or 'es_ES', etc. it said
that those were not valid locaes. Worst of all, when I tried 'es' it
said that this was estonian?! Obviously, this is not what ISO 639 says.
'es' should be Spanish, and Estonian should be 'et.

Anyway, I'd love to have a method called get_available_locales to tell
me what I can use on my machine, or something like that.

Can anyone tell me how I *do* get these names?

Thanks

 
Reply With Quote
 
 
 
 
Damjan
Guest
Posts: n/a
 
      04-20-2005
> Is there some sort of tutorial on locales or the locale module?
>
> I can't seem to find a list showing all possible locales.


I think this depends on the platform

> Anyway, I'd love to have a method called get_available_locales to tell
> me what I can use on my machine, or something like that.
>
> Can anyone tell me how I *do* get these names?


In linux (glibc) you can see all locales with "locale -a".


--
damjan
 
Reply With Quote
 
 
 
 
vincent wehren
Guest
Posts: n/a
 
      04-20-2005

<(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed) ups.com...
|
| Is there some sort of tutorial on locales or the locale module?
|
| I can't seem to find a list showing all possible locales. I made 'en'
| work alright, but when I tried 'de' or 'de_DE' or 'es_ES', etc. it said
| that those were not valid locaes. Worst of all, when I tried 'es' it
| said that this was estonian?! Obviously, this is not what ISO 639 says.
| 'es' should be Spanish, and Estonian should be 'et.

What makes you think that the underlying C-runtime library cares about
ISO639? If you're on Windows (which from what you've written I assume you
are), you might want to look at:

http://msdn.microsoft.com/library/de...ge_strings.asp

(Unfortunately, I know for a fact that this list is *not* exhaustive, at
least not for WIN2K or XP.)

In addition, you might want to keep in mind - and again this applies to the
Windows platform - that what is returned by locale.getdefaultlocale is not
suitable as input for the the country/language argument of locale.setlocale
(which is somewhat of a pitty, cause I sometimes wish I could do something
like "locale.setlocale(locale.LC_ALL,
".".join(locale.getdefaultlocale())" ).

However, if you really need super-deluxe localization/national language
support independent of the C runtime on Windows you may need to wrap the
appropriate functions living in winnls.h (or the version of winnls.h
contained in the platform SDK) - some of which may have already found there
way into the Python for Win32 Extensions (GetDateFormat for example).


Regards,

--

Vincent Wehren

|
| Anyway, I'd love to have a method called get_available_locales to tell
| me what I can use on my machine, or something like that.
|
| Can anyone tell me how I *do* get these names?
|
| Thanks
|


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using locales for dates nileshkaria@gmail.com C++ 0 10-11-2006 07:49 PM
Problem using locales B.D. C++ 4 02-12-2006 06:09 PM
Datagrid sorting from different locales. =?Utf-8?B?YWxhbg==?= ASP .Net 0 04-21-2005 11:21 AM
sorting issue when using locales Heinz Werntges Ruby 0 09-25-2003 09:52 PM
Problem installing facets into locales explicitly David List C++ 0 08-06-2003 03:37 PM



Advertisments