X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed58dbeab64d18a0f869ea8e1610a0a88ad7b22c..6842d18650b487249b4ae29d0d7e17231b24cde8:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 3dd7a175ad..1172719390 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -267,7 +267,7 @@ static wxString GetAllMsgCatalogSubdirs(const wxChar *prefix, // search first in prefix/fr/LC_MESSAGES, then in prefix/fr and finally in // prefix (assuming the language is 'fr') searchPath << prefix << wxFILE_SEP_PATH << lang << wxFILE_SEP_PATH - << _T("LC_MESSAGES") << wxPATH_SEP + << wxT("LC_MESSAGES") << wxPATH_SEP << prefix << wxFILE_SEP_PATH << lang << wxPATH_SEP << prefix << wxPATH_SEP; @@ -289,13 +289,13 @@ static wxString GetFullSearchPath(const wxChar *lang) // then take the current directory // FIXME it should be the directory of the executable - searchPath << GetAllMsgCatalogSubdirs(_T("."), lang) << wxPATH_SEP; + searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang) << wxPATH_SEP; // and finally add some standard ones searchPath - << GetAllMsgCatalogSubdirs(_T("/usr/share/locale"), lang) << wxPATH_SEP - << GetAllMsgCatalogSubdirs(_T("/usr/lib/locale"), lang) << wxPATH_SEP - << GetAllMsgCatalogSubdirs(_T("/usr/local/share/locale"), lang); + << GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang) << wxPATH_SEP + << GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang) << wxPATH_SEP + << GetAllMsgCatalogSubdirs(wxT("/usr/local/share/locale"), lang); return searchPath; } @@ -320,7 +320,7 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0) #endif // 0 wxString searchPath = GetFullSearchPath(szDirPrefix); - const wxChar *sublocale = wxStrchr(szDirPrefix, _T('_')); + const wxChar *sublocale = wxStrchr(szDirPrefix, wxT('_')); if ( sublocale ) { // also add just base locale name: for things like "fr_BE" (belgium @@ -340,10 +340,8 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0) // (we're using an object because we have several return paths) NoTransErr noTransErr; -// Then why do you translate at all? Just use _T() and not _(). RR. - - wxLogVerbose(_("looking for catalog '%s' in path '%s'."), - szName.c_str, searchPath.c_str()); + wxLogVerbose(wxT("looking for catalog '%s' in path '%s'."), + szName.c_str(), searchPath.c_str()); wxString strFullName; if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) { @@ -425,7 +423,7 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const if ( nStr == 0 ) return NULL; - if ( strcmp(szOrig, StringAtOfs(m_pOrigTable, nStr - 1)) == 0 ) + if ( wxStrcmp(szOrig, StringAtOfs(m_pOrigTable, nStr - 1)) == 0 ) return StringAtOfs(m_pTransTable, nStr - 1); if ( nIndex >= m_nHashSize - nIncr) @@ -440,7 +438,7 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const current; while ( bottom < top ) { current = (bottom + top) / 2; - int res = strcmp(szOrig, StringAtOfs(m_pOrigTable, current)); + int res = wxStrcmp(szOrig, StringAtOfs(m_pOrigTable, current)); if ( res < 0 ) top = current; else if ( res > 0 ) @@ -475,7 +473,10 @@ bool wxLocale::Init(const wxChar *szName, // change current locale (default: same as long name) if ( szLocale == NULL ) - szLocale = szName; + { + // the argument to setlocale() + szLocale = szShort; + } m_pszOldLocale = wxSetlocale(LC_ALL, szLocale); if ( m_pszOldLocale == NULL ) wxLogError(_("locale '%s' can not be set."), szLocale); @@ -495,7 +496,7 @@ bool wxLocale::Init(const wxChar *szName, m_pMsgCat = NULL; bool bOk = TRUE; if ( bLoadDefault ) - bOk = AddCatalog(_T("wxstd")); + bOk = AddCatalog(wxT("wxstd")); return bOk; } @@ -527,13 +528,17 @@ wxLocale::~wxLocale() // get the translation of given string in current locale const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, - const wxChar *szDomain) const + const wxChar *szDomain) const { if ( wxIsEmpty(szOrigString) ) return szDomain; const char *pszTrans = NULL; +#if wxUSE_UNICODE const wxWX2MBbuf szOrgString = wxConvCurrent->cWX2MB(szOrigString); +#else // ANSI + #define szOrgString szOrigString +#endif // Unicode/ANSI wxMsgCatalog *pMsgCat; if ( szDomain != NULL ) { @@ -580,7 +585,12 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, return (wxMB2WXbuf)(szOrigString); } else - return (wxMB2WXbuf)(wxConvCurrent->cMB2WX(pszTrans)); + { + return wxConvertMB2WX(pszTrans); // or preferably wxCSConv(charset).cMB2WX(pszTrans) or something, + // a macro similar to wxConvertMB2WX could be written for that + } + + #undef szOrgString } // find catalog by name in a linked list, return NULL if !found