made error "locale couldn't be set" a verbose message instead, use WXDIR to
find wxstd.mo git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8013 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -51,7 +51,11 @@ understand: first of all, the application locale is changed - note that this
|
||||
will affect many of standard C library functions such as printf() or strftime().
|
||||
Second, this wxLocale object becomes the new current global locale for the
|
||||
application and so all subsequent calls to wxGetTranslation() will try to
|
||||
translate the messages using the message catalogs for this locale.
|
||||
translate the messages using the message catalogs for this locale. Finally,
|
||||
unless bLoadDefault parameter is FALSE, the method also loads the wxstd.mo
|
||||
catalog (which is looked for in all the usual places and, additionally, under
|
||||
the location specified bythe environment variable WXDIR if it is set) which
|
||||
will allow to translate all the messages generated by the library itself.
|
||||
|
||||
\membersection{wxLocale::\destruct{wxLocale}}\label{wxlocaledtor}
|
||||
|
||||
|
@@ -308,11 +308,13 @@ static wxString GetFullSearchPath(const wxChar *lang)
|
||||
// FIXME it should be the directory of the executable
|
||||
searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang);
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
// and finally add some standard ones
|
||||
searchPath
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang)
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang)
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/local/share/locale"), lang);
|
||||
#endif // __UNIX_LIKE__
|
||||
|
||||
return searchPath;
|
||||
}
|
||||
@@ -329,6 +331,21 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0, bool b
|
||||
szName = szName.Left(szName.Find(wxT('.')));
|
||||
|
||||
wxString searchPath = GetFullSearchPath(szDirPrefix);
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
if ( szName == _("wxstd") )
|
||||
{
|
||||
// WXDIR is the env var holding the installation directory of wxWindows
|
||||
const wxChar *pszWxDir = wxGetenv(wxT("WXDIR"));
|
||||
if ( pszWxDir )
|
||||
{
|
||||
wxString strWxLoc;
|
||||
strWxLoc << pszWxDir << wxFILE_SEP_PATH << wxT("share/locale");
|
||||
searchPath << GetAllMsgCatalogSubdirs(strWxLoc, szDirPrefix);
|
||||
}
|
||||
}
|
||||
#endif // __UNIX_LIKE__
|
||||
|
||||
const wxChar *sublocale = wxStrchr(szDirPrefix, wxT('_'));
|
||||
if ( sublocale )
|
||||
{
|
||||
@@ -546,7 +563,11 @@ bool wxLocale::Init(const wxChar *szName,
|
||||
}
|
||||
m_pszOldLocale = wxSetlocale(LC_ALL, szLocale);
|
||||
if ( m_pszOldLocale == NULL )
|
||||
wxLogError(_("locale '%s' can not be set."), szLocale);
|
||||
{
|
||||
// this is not an error as most systems don't support anything but "C"
|
||||
// anyhow
|
||||
wxLogVerbose(_("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
|
||||
|
Reference in New Issue
Block a user