By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,587 Members | 1,731 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,587 IT Pros & Developers. It's quick & easy.

using locales

P: n/a

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

Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> 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
Jul 19 '05 #2

P: n/a

<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
|
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.