bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default Windows locale for localename.c


From: lrn1986
Subject: Re: Default Windows locale for localename.c
Date: Thu, 15 Mar 2018 19:57:40 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:59.0) Gecko/20100101 Thunderbird/59.0

On 15.03.2018 11:40, Eli Zaretskii wrote:
From: address@hidden
Cc: Eli Zaretskii <address@hidden>
Date: Wed, 14 Mar 2018 01:26:27 +0300

For English UI and Russian format setting:

GetUserDefaultUILanguage() returns:
0x409 (primary ID 0x9 sub ID 0x1 (meaning en_US)).

GetUserPreferredUILanguages() returns:
"0409" for language ID and "en-US" for language name.
(1 language, in a 00-terminated string).


For Russian UI and English format setting:

GetUserDefaultUILanguage() returns:
0x419 (primary ID 0x19 sub ID 0x1 (meaning ru_RU)).

GetUserPreferredUILanguages() returns:
"0419" for language ID and "ru-RU" for language name.
"0409" for language ID and "en-US" for language name.
(2 languages, in a 0-delimited, 00-terminated string).

Since there's no POSIX api for returning a list of locales, we'd be OK with
just GetUserDefaultUILanguage() (although MSDN recommends
GetUserPreferredUILanguages(), since it returns strings and thus can represent
custom locales; though we might need new code for parsing its output).

I think just calling setlocale should be enough, and if gettext calls
gl_locale_name, you will have what you want.  Calling Win32 APIs
directly is not something I recommend, unless there's no other way of
doing something reasonable by using CRT functions.


Well, that's a pity. And here i already made a patch for this...

Sorry, it's not a git format-patch (turns out gettext git repo doesn't carry all these multiple copies of gnulib around, so there's almost nothing to patch there).

Attachment: 0140-use-ui-lang-instead-of-locale.all.patch
Description: Text document

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]