On 15.03.2018 11:40, Eli Zaretskii wrote:
From: LRN
Cc: Eli Zaretskii
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).