diff options
author | Wim Leflere <wim.leflere@gmail.com> | 2021-04-09 11:22:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 11:22:03 +0200 |
commit | 5233fd275146ced3a0338d1740cef024be4063f5 (patch) | |
tree | fcdc142cb8a799be88a3431736b745b427108895 /src/os/windows | |
parent | 2b86d42ddc9bfd6aef2856ec953cb03eefe6cd12 (diff) | |
download | openttd-5233fd275146ced3a0338d1740cef024be4063f5.tar.xz |
Change: [win32] Use user UI language for initial language selection (#8973) (#8974)
Diffstat (limited to 'src/os/windows')
-rw-r--r-- | src/os/windows/win32.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 3f72d1e72..073f70b98 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -629,9 +629,12 @@ wchar_t *convert_to_fs(const char *name, wchar_t *system_buf, size_t buflen) /** 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; } |