X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fbd067d3cf19ad8c4fe6c3b1005e770f5ac6405..81533a3af6ed598c32a35e1c1c2b60f4908f5541:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 978b4b41e5..0638da4e95 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -70,7 +70,6 @@ #include "wx/apptrait.h" #include "wx/stdpaths.h" #include "wx/hashset.h" -#include "wx/filesys.h" #if defined(__WXOSX__) #include "wx/osx/core/cfref.h" @@ -1005,7 +1004,7 @@ static wxString wxGetANSICodePageForLocale(LCID lcid) if ( ::GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buffer, WXSIZEOF(buffer)) > 0 ) { - if ( buffer[0] != _T('0') || buffer[1] != _T('\0') ) + if ( buffer[0] != wxT('0') || buffer[1] != wxT('\0') ) cp = buffer; //else: this locale doesn't use ANSI code page } @@ -1025,10 +1024,10 @@ wxString wxLanguageInfo::GetLocaleName() const const LCID lcid = GetLCID(); wxChar buffer[256]; - buffer[0] = _T('\0'); + buffer[0] = wxT('\0'); if ( !::GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, WXSIZEOF(buffer)) ) { - wxLogLastError(_T("GetLocaleInfo(LOCALE_SENGLANGUAGE)")); + wxLogLastError(wxT("GetLocaleInfo(LOCALE_SENGLANGUAGE)")); return locale; } @@ -1036,13 +1035,13 @@ wxString wxLanguageInfo::GetLocaleName() const if ( ::GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, buffer, WXSIZEOF(buffer)) > 0 ) { - locale << _T('_') << buffer; + locale << wxT('_') << buffer; } const wxString cp = wxGetANSICodePageForLocale(lcid); if ( !cp.empty() ) { - locale << _T('.') << cp; + locale << wxT('.') << cp; } return locale; @@ -1190,12 +1189,7 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName, fn.SetExt(wxS("mo")); wxString strFullName; -#if wxUSE_FILESYSTEM - wxFileSystem fileSys; - if ( !fileSys.FindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) -#else // !wxUSE_FILESYSTEM if ( !wxFindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) -#endif // wxUSE_FILESYSTEM/!wxUSE_FILESYSTEM { wxLogVerbose(_("catalog file for domain '%s' not found."), szName); wxLogTrace(TRACE_I18N, wxS("Catalog \"%s.mo\" not found"), szName); @@ -1206,22 +1200,6 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName, wxLogVerbose(_("using catalog '%s' from '%s'."), szName, strFullName.c_str()); wxLogTrace(TRACE_I18N, wxS("Using catalog \"%s\"."), strFullName.c_str()); -#if wxUSE_FILESYSTEM - wxFSFile * const fileMsg = fileSys.OpenFile(strFullName); - if ( !fileMsg ) - return false; - - wxInputStream *fileStream = fileMsg->GetStream(); - m_data.SetDataLen(0); - - static const size_t chunkSize = 4096; - while ( !fileStream->Eof() ) { - fileStream->Read(m_data.GetAppendBuf(chunkSize), chunkSize); - m_data.UngetAppendBuf(fileStream->LastRead()); - } - - delete fileMsg; -#else // !wxUSE_FILESYSTEM wxFile fileMsg(strFullName); if ( !fileMsg.IsOpened() ) return false; @@ -1239,7 +1217,6 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName, return false; m_data.UngetWriteBuf(nSize); -#endif // wxUSE_FILESYSTEM/!wxUSE_FILESYSTEM // examine header @@ -1635,7 +1612,9 @@ bool wxLocale::Init(const wxString& name, m_pszOldLocale = NULL; if ( m_pszOldLocale == NULL ) + { wxLogError(_("locale '%s' can not be set."), szLocale); + } // the short name will be used to look for catalog files as well, // so we need something here @@ -2612,8 +2591,8 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) char chLast = '\0'; size_t lastCount = 0; - - const char* formatchars = + + const char* formatchars = "dghHmMsSy" #ifdef __WXMSW__ "t" @@ -2809,7 +2788,7 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) // strftime() doesn't have era string, // ignore this format wxASSERT_MSG( lastCount <= 2, "too many 'g's" ); - + break; #ifndef __WXMSW__ case 'a': @@ -2842,10 +2821,10 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) break; // not a special character so must be just a separator, treat as is - if ( *p == _T('%') ) + if ( *p == wxT('%') ) { // this one needs to be escaped - fmtWX += _T('%'); + fmtWX += wxT('%'); } fmtWX += *p; @@ -3095,6 +3074,8 @@ wxString GetDateFormatFromLangInfo(wxLocaleInfo index) return fmtDateOnly; #else // !HAVE_LANGINFO_H + wxUnusedVar(index); + // no fallback, let the application deal with unavailability of // nl_langinfo() itself as there is no good way for us to do it (well, we // could try to reverse engineer the format from strftime() output but this