<ga******@hotmail.com> schrieb im Newsbeitrag
news:11*********************@l41g2000cwc.googlegro 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
|