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: Eli Zaretskii
Subject: Re: Default Windows locale for localename.c
Date: Thu, 15 Mar 2018 10:40:54 +0200

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



reply via email to

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