<< wxPATH_SEP;
}
+ // TODO: use wxStandardPaths instead of all this mess!!
+
// LC_PATH is a standard env var containing the search path for the .mo
// files
#ifndef __WXWINCE__
// then take the current directory
// FIXME it should be the directory of the executable
-#ifdef __WXMAC__
- wxChar cwd[512] ;
- wxGetWorkingDirectory( cwd , sizeof( cwd ) ) ;
- searchPath << GetAllMsgCatalogSubdirs(cwd, lang);
+#if defined(__WXMAC__)
+ searchPath << GetAllMsgCatalogSubdirs(wxGetCwd(), lang);
// generic search paths could be somewhere in the system folder preferences
-#else // !Mac
+#elif defined(__WXMSW__)
+ // look in the directory of the executable
+ wxString path;
+ wxSplitPath(wxGetFullModuleName(), &path, NULL, NULL);
+ searchPath << GetAllMsgCatalogSubdirs(path, lang);
+#else // !Mac, !MSW
searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang);
-
#endif // platform
return searchPath;
return false;
// get the file size (assume it is less than 4Gb...)
- wxFileSize_t nSize = fileMsg.Length();
+ wxFileOffset nSize = fileMsg.Length();
if ( nSize == wxInvalidOffset )
return false;
// read the whole file in memory
m_pData = new size_t8[nSize];
- if ( fileMsg.Read(m_pData, nSize) != nSize ) {
+ if ( fileMsg.Read(m_pData, (size_t)nSize) != nSize ) {
wxDELETEA(m_pData);
return false;
}
// examine header
- bool bValid = nSize > sizeof(wxMsgCatalogHeader);
+ bool bValid = nSize + (size_t)0 > sizeof(wxMsgCatalogHeader);
wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData;
if ( bValid ) {
Swap(pHeader->ofsOrigTable));
m_pTransTable = (wxMsgTableEntry *)(m_pData +
Swap(pHeader->ofsTransTable));
- m_nSize = nSize;
+ m_nSize = (size_t32)nSize;
// now parse catalog's header and try to extract catalog charset and
// plural forms formula from it:
wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
return false;
}
-#elif defined(__WXMAC__) || defined(__WXPM__)
+#elif defined(__WXMAC__)
+ if (language == wxLANGUAGE_DEFAULT)
+ locale = wxEmptyString;
+ else
+ locale = info->CanonicalName;
+
+ wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale);
+
+ if ( !retloc )
+ {
+ // Some C libraries don't like xx_YY form and require xx only
+ retloc = wxSetlocale(LC_ALL, locale.Mid(0,2));
+ }
+ if ( !retloc )
+ {
+ wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
+ return false;
+ }
+#elif defined(__WXPM__)
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#else
return false;
// FIXME: what is the error return value for GetACP()?
UINT codepage = ::GetACP();
encname.Printf(_T("windows-%u"), codepage);
+#elif defined(__WXMAC__)
+ // default is just empty string, this resolves to the default system
+ // encoding later
#elif defined(__UNIX_LIKE__)
#if defined(HAVE_LANGINFO_H) && defined(CODESET)