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: Wed, 14 Mar 2018 01:26:27 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:59.0) Gecko/20100101 Thunderbird/59.0

On 13.03.2018 19:11, LRN wrote:
MSDN [1] explains the multiple language
situation in Vista+ (which is what we should aim to use; XP can just keep using
GetThreadLocale() for all i care; that said, GetUserDefaultUILanguage() is
claimed to be 2000+, so we could use that) and that
GetUserDefaultUILanguage()/GetUserPreferredUILanguages() return the UI
language(s) for the user.

MSDN [1] also lists per-process and per-thread language functions, but these
either default to empty return string or explicitly fall back to more generic
User/System/Install language.

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/dd374098(v=vs.85).aspx


Tested it out.

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).

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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