X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bea561cec04633a5810f3166107bd2d0288d4091..84aa68c427aab0b6604c68aa6b228714ef48b66c:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index f0512af3cc..ad9d29f161 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1226,7 +1226,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, { #if wxUSE_WCHAR_T wxCSConv *csConv = NULL; - if ( !m_charset.IsEmpty() ) + if ( !m_charset.empty() ) csConv = new wxCSConv(m_charset); wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent; @@ -1402,7 +1402,9 @@ wxLanguageInfoArray *wxLocale::ms_languagesDB = NULL; void wxLocale::DoCommonInit() { m_pszOldLocale = NULL; - m_pOldLocale = NULL; + + m_pOldLocale = wxSetLocale(this); + m_pMsgCat = NULL; m_language = wxLANGUAGE_UNKNOWN; m_initialized = false; @@ -1460,7 +1462,7 @@ bool wxLocale::Init(const wxChar *szName, // the short name will be used to look for catalog files as well, // so we need something here - if ( m_strShort.IsEmpty() ) { + if ( m_strShort.empty() ) { // FIXME I don't know how these 2 letter abbreviations are formed, // this wild guess is surely wrong if ( szLocale && szLocale[0] ) @@ -1471,9 +1473,6 @@ bool wxLocale::Init(const wxChar *szName, } } - // save the old locale to be able to restore it later - m_pOldLocale = wxSetLocale(this); - // load the default catalog with wxWidgets standard messages m_pMsgCat = NULL; bool bOk = true; @@ -1638,7 +1637,7 @@ bool wxLocale::Init(int language, int flags) if (codepage != 0) locale << wxT(".") << buffer; } - if (locale.IsEmpty()) + if (locale.empty()) { wxLogLastError(wxT("SetThreadLocale")); wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); @@ -1687,7 +1686,7 @@ bool wxLocale::Init(int language, int flags) return false; } #elif defined(__WXMAC__) - if (language == wxLANGUAGE_DEFAULT) + if (lang == wxLANGUAGE_DEFAULT) locale = wxEmptyString; else locale = info->CanonicalName; @@ -2449,9 +2448,8 @@ wxLocale::~wxLocale() delete pTmpCat; } - // restore old locale if we had changed it - if ( m_pOldLocale ) - wxSetLocale(m_pOldLocale); + // restore old locale pointer + wxSetLocale(m_pOldLocale); // FIXME #ifndef __WXWINCE__ @@ -2547,14 +2545,14 @@ wxString wxLocale::GetHeaderValue( const wxChar* szHeader, if ( pMsgCat == NULL ) return wxEmptyString; - pszTrans = pMsgCat->GetString(wxT(""), (size_t)-1); + pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); } else { // search in all domains for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) { - pszTrans = pMsgCat->GetString(wxT(""), (size_t)-1); + pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); if ( pszTrans != NULL ) // take the first found break; }