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.
This commit is contained in:
Vadim Zeitlin
2021-03-02 18:06:48 +01:00
parent 9c4ab145e9
commit 502114261a

View File

@@ -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 )