X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e3062291922189a215b81a0ae4fc4022ace597b..4a699e3a59b19c21b6faae714b56cac5a75df2e2:/src/common/translation.cpp diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 71a16ca847..379eccc45c 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -50,7 +50,7 @@ #include "wx/stdpaths.h" #include "wx/hashset.h" -#ifdef __WXMSW__ +#ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #endif @@ -885,7 +885,7 @@ private: }; // ---------------------------------------------------------------------------- -// wxMsgCatalogFile clas +// wxMsgCatalogFile class // ---------------------------------------------------------------------------- wxMsgCatalogFile::wxMsgCatalogFile() @@ -904,7 +904,7 @@ bool wxMsgCatalogFile::LoadFile(const wxString& filename, if ( !fileMsg.IsOpened() ) return false; - // get the file size (assume it is less than 4Gb...) + // get the file size (assume it is less than 4GB...) wxFileOffset lenFile = fileMsg.Length(); if ( lenFile == wxInvalidOffset ) return false; @@ -986,7 +986,7 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data, if ( m_charset == wxS("CHARSET") ) { // "CHARSET" is not valid charset, but lazy translator - m_charset.empty(); + m_charset.clear(); } } } @@ -1294,7 +1294,7 @@ void wxTranslations::SetLanguage(const wxString& lang) wxArrayString wxTranslations::GetAvailableTranslations(const wxString& domain) const { - wxCHECK_MSG( m_loader, false, "loader can't be NULL" ); + wxCHECK_MSG( m_loader, wxArrayString(), "loader can't be NULL" ); return m_loader->GetAvailableTranslations(domain); } @@ -1440,7 +1440,7 @@ wxString wxTranslations::ChooseLanguageForDomain(const wxString& WXUNUSED(domain namespace { -WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, +WX_DECLARE_HASH_SET(wxString, ::wxStringHash, ::wxStringEqual, wxLocaleUntranslatedStrings); } @@ -1500,8 +1500,8 @@ const wxString& wxTranslations::GetString(const wxString& origString, TRACE_I18N, "string \"%s\"%s not found in %slocale '%s'.", origString, - n != UINT_MAX ? wxString::Format("[%ld]", (long)n) : wxString(), - !domain.empty() ? wxString::Format("domain '%s' ", domain) : wxString(), + (n != UINT_MAX ? wxString::Format("[%ld]", (long)n) : wxString()), + (!domain.empty() ? wxString::Format("domain '%s' ", domain) : wxString()), m_lang ); @@ -1741,6 +1741,8 @@ wxArrayString wxFileTranslationsLoader::GetAvailableTranslations(const wxString& i != prefixes.end(); ++i ) { + if ( i->empty() ) + continue; wxDir dir; if ( !dir.Open(*i) ) continue; @@ -1788,7 +1790,7 @@ wxMsgCatalog *wxResourceTranslationsLoader::LoadCatalog(const wxString& domain, resname, GetResourceType(), GetModule()) ) - return false; + return NULL; wxLogTrace(TRACE_I18N, "Using catalog from Windows resource \"%s\".", resname); @@ -1798,7 +1800,9 @@ wxMsgCatalog *wxResourceTranslationsLoader::LoadCatalog(const wxString& domain, domain); if ( !cat ) + { wxLogWarning(_("Resource '%s' is not a valid message catalog."), resname); + } return cat; } @@ -1839,13 +1843,15 @@ wxArrayString wxResourceTranslationsLoader::GetAvailableTranslations(const wxStr data.prefix.MakeLower(); // resource names are case insensitive if ( !EnumResourceNames(GetModule(), - GetResourceType(), + GetResourceType().t_str(), EnumTranslations, reinterpret_cast(&data)) ) { const DWORD err = GetLastError(); if ( err != NO_ERROR && err != ERROR_RESOURCE_TYPE_NOT_FOUND ) + { wxLogSysError(_("Couldn't enumerate translations")); + } } return data.langs;