mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 12:44:10 +01:00
This commit is contained in:
committed by
Charles Pigott
parent
5c6b43832c
commit
9d233bb7d4
@@ -625,9 +625,12 @@ wchar_t *convert_to_fs(const char *name, wchar_t *system_buf, size_t buflen, boo
|
||||
/** Determine the current user's locale. */
|
||||
const char *GetCurrentLocale(const char *)
|
||||
{
|
||||
const LANGID userUiLang = GetUserDefaultUILanguage();
|
||||
const LCID userUiLocale = MAKELCID(userUiLang, SORT_DEFAULT);
|
||||
|
||||
char lang[9], country[9];
|
||||
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lang, lengthof(lang)) == 0 ||
|
||||
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, country, lengthof(country)) == 0) {
|
||||
if (GetLocaleInfoA(userUiLocale, LOCALE_SISO639LANGNAME, lang, lengthof(lang)) == 0 ||
|
||||
GetLocaleInfoA(userUiLocale, LOCALE_SISO3166CTRYNAME, country, lengthof(country)) == 0) {
|
||||
/* Unable to retrieve the locale. */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user