using locales

Discussion in 'Python' started by garykpdx@hotmail.com, Apr 20, 2005.

  1. Guest

    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
     
    , Apr 20, 2005
    #1
    1. Advertising

  2. Damjan Guest

    > 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
     
    Damjan, Apr 20, 2005
    #2
    1. Advertising

  3. <> schrieb im Newsbeitrag
    news:...
    |
    | 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
    |
     
    vincent wehren, Apr 20, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YWxhbg==?=

    Datagrid sorting from different locales.

    =?Utf-8?B?YWxhbg==?=, Apr 21, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    429
    =?Utf-8?B?YWxhbg==?=
    Apr 21, 2005
  2. David List
    Replies:
    0
    Views:
    307
    David List
    Aug 6, 2003
  3. B.D.

    Problem using locales

    B.D., Feb 11, 2006, in forum: C++
    Replies:
    4
    Views:
    391
  4. Replies:
    0
    Views:
    308
  5. Heinz Werntges

    sorting issue when using locales

    Heinz Werntges, Sep 25, 2003, in forum: Ruby
    Replies:
    0
    Views:
    105
    Heinz Werntges
    Sep 25, 2003
Loading...

Share This Page