using locales

G

garykpdx

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
 
D

Damjan

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".
 
V

vincent wehren

|
| 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/d...ry/en-us/vclib/html/_crt_language_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
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top