From 502114261ac3577a613802f34600a12971c78cff Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 2 Mar 2021 18:06:48 +0100 Subject: [PATCH] Handle wxLANGUAGE_DEFAULT in wxLocale specially under MSW too Even if we do know about the system language, it's still better to let OS/CRT handle it, as we may not know enough about it. E.g. "system language" may actually be a mix of the different languages and formats and we don't handle this case at all, while OS/CRT do just fine. --- src/common/intl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 85d8019e92..32191a40f0 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -547,10 +547,14 @@ bool wxLocale::Init(int lang, int flags) #elif defined(__WIN32__) const char *retloc; - if ( !info ) + if ( lang == wxLANGUAGE_DEFAULT ) { - // We're using the system language, but we don't know what it is, so - // just use setlocale() to deal with it. + ::SetThreadLocale(LOCALE_USER_DEFAULT); + wxMSWSetThreadUILanguage(LANG_USER_DEFAULT); + + // We're using the system language, so let setlocale() deal with it: it + // does it better than we do and we might not even know about this + // language in the first place. retloc = wxSetlocale(LC_ALL, ""); } else if ( info->WinLang == 0 )