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:
@@ -55,6 +55,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
#include "wx/dynlib.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -480,6 +481,18 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
|
|
||||||
// change locale used by Windows functions
|
// change locale used by Windows functions
|
||||||
::SetThreadLocale(lcid);
|
::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
|
#endif
|
||||||
|
|
||||||
// and also call setlocale() to change locale used by the CRT
|
// and also call setlocale() to change locale used by the CRT
|
||||||
|
Reference in New Issue
Block a user