Call SetThreadUILanguage() on Windows

Starting with Vista, SetThreadLocale() does basically nothing and does
not affect UI language. We need to call SetThreadUILanguage() as well
from wxLocale::Init() to have the locale reflected in e.g. standard
dialogs.
This commit is contained in:
Vaclav Slavik
2015-06-10 18:32:49 +02:00
parent 264f01824b
commit fd08f641ae

View File

@@ -55,6 +55,7 @@
#endif
#ifdef __WIN32__
#include "wx/dynlib.h"
#include "wx/msw/private.h"
#endif
@@ -480,6 +481,18 @@ bool wxLocale::Init(int language, int flags)
// change locale used by Windows functions
::SetThreadLocale(lcid);
// SetThreadUILanguage() may be available on XP, but with unclear
// behavior, so avoid calling it there.
if ( wxGetWinVersion() >= wxWinVersion_Vista )
{
wxLoadedDLL dllKernel32(wxS("kernel32.dll"));
typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID);
SetThreadUILanguage_t pfnSetThreadUILanguage = NULL;
wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32);
if (pfnSetThreadUILanguage)
pfnSetThreadUILanguage(LANGIDFROMLCID(lcid));
}
#endif
// and also call setlocale() to change locale used by the CRT