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).
signature.asc
Description: OpenPGP digital signature