diff --git a/include/wx/intl.h b/include/wx/intl.h index d66e3043d8..c551042754 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -363,6 +363,9 @@ private: const char *m_pszOldLocale; // previous locale from setlocale() wxLocale *m_pOldLocale; // previous wxLocale +#ifdef __WIN32__ + wxUint32 m_oldLCID; +#endif bool m_initialized; diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 0b0d8798f4..6ec7ed6f28 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -253,6 +253,9 @@ void wxLocale::DoCommonInit() if ( m_pszOldLocale ) m_pszOldLocale = wxStrdup(m_pszOldLocale); +#ifdef __WIN32__ + m_oldLCID = ::GetThreadLocale(); +#endif m_pOldLocale = wxSetLocale(this); @@ -1098,6 +1101,11 @@ wxLocale::~wxLocale() wxSetlocale(LC_ALL, m_pszOldLocale); free(const_cast(m_pszOldLocale)); } + +#ifdef __WIN32__ + ::SetThreadLocale(m_oldLCID); + wxMSWSetThreadUILanguage(LANGIDFROMLCID(m_oldLCID)); +#endif } @@ -1688,10 +1696,7 @@ GetInfoFromLCID(LCID lcid, /* static */ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) { - const wxLanguageInfo * const - info = wxGetLocale() ? GetLanguageInfo(wxGetLocale()->GetLanguage()) - : NULL; - if ( !info ) + if ( !wxGetLocale() ) { // wxSetLocale() hadn't been called yet of failed, hence CRT must be // using "C" locale -- but check it to detect bugs that would happen if @@ -1734,7 +1739,8 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) } } - return GetInfoFromLCID(info->GetLCID(), index, cat); + // wxSetLocale() succeeded and so thread locale was set together with CRT one. + return GetInfoFromLCID(::GetThreadLocale(), index, cat); } /* static */