merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,17 +103,33 @@ const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495;
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// suppress further error messages about missing translations
|
||||
// (if you don't have one catalog file, you wouldn't like to see the
|
||||
// error message for each string in it, so normally it's given only
|
||||
// once)
|
||||
void wxSuppressTransErrors();
|
||||
#ifdef __WXDEBUG__
|
||||
|
||||
// restore the logging
|
||||
void wxRestoreTransErrors();
|
||||
// small class to suppress the translation erros until exit from current scope
|
||||
class NoTransErr
|
||||
{
|
||||
public:
|
||||
NoTransErr() { ms_suppressCount++; }
|
||||
~NoTransErr() { ms_suppressCount--; }
|
||||
|
||||
// get the current state
|
||||
bool wxIsLoggingTransErrors();
|
||||
static bool Suppress() { return ms_suppressCount > 0; }
|
||||
|
||||
private:
|
||||
static size_t ms_suppressCount;
|
||||
};
|
||||
|
||||
size_t NoTransErr::ms_suppressCount = 0;
|
||||
|
||||
#else // !Debug
|
||||
|
||||
class NoTransErr
|
||||
{
|
||||
public:
|
||||
NoTransErr() { }
|
||||
~NoTransErr() { }
|
||||
};
|
||||
|
||||
#endif // Debug/!Debug
|
||||
|
||||
static wxLocale *wxSetLocale(wxLocale *pLocale);
|
||||
|
||||
@@ -253,14 +269,6 @@ wxMsgCatalog::~wxMsgCatalog()
|
||||
wxDELETEA(m_pszName);
|
||||
}
|
||||
|
||||
// small class to suppress the translation erros until exit from current scope
|
||||
class NoTransErr
|
||||
{
|
||||
public:
|
||||
NoTransErr() { wxSuppressTransErrors(); }
|
||||
~NoTransErr() { wxRestoreTransErrors(); }
|
||||
};
|
||||
|
||||
// return all directories to search for given prefix
|
||||
static wxString GetAllMsgCatalogSubdirs(const wxChar *prefix,
|
||||
const wxChar *lang)
|
||||
@@ -292,7 +300,7 @@ static wxString GetFullSearchPath(const wxChar *lang)
|
||||
|
||||
// LC_PATH is a standard env var containing the search path for the .mo
|
||||
// files
|
||||
const wxChar *pszLcPath = wxGetenv("LC_PATH");
|
||||
const wxChar *pszLcPath = wxGetenv(wxT("LC_PATH"));
|
||||
if ( pszLcPath != NULL )
|
||||
searchPath << GetAllMsgCatalogSubdirs(pszLcPath, lang);
|
||||
|
||||
@@ -617,29 +625,22 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString,
|
||||
}
|
||||
|
||||
if ( pszTrans == NULL ) {
|
||||
if ( wxIsLoggingTransErrors() ) {
|
||||
// suppress further error messages if we're not debugging: this avoids
|
||||
// flooding the user with messages about each and every missing string if,
|
||||
// for example, a whole catalog file is missing.
|
||||
|
||||
// do it before calling LogWarning to prevent infinite recursion!
|
||||
#ifdef __WXDEBUG__
|
||||
if ( !NoTransErr::Suppress() ) {
|
||||
NoTransErr noTransErr;
|
||||
#else // !debug
|
||||
wxSuppressTransErrors();
|
||||
#endif // debug/!debug
|
||||
|
||||
if ( szDomain != NULL )
|
||||
{
|
||||
wxLogWarning(_("string '%s' not found in domain '%s' for locale '%s'."),
|
||||
wxLogDebug(_T("string '%s' not found in domain '%s' for locale '%s'."),
|
||||
szOrigString, szDomain, m_strLocale.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning(_("string '%s' not found in locale '%s'."),
|
||||
szOrigString, m_strLocale.c_str());
|
||||
wxLogDebug(_T("string '%s' not found in locale '%s'."),
|
||||
szOrigString, m_strLocale.c_str());
|
||||
}
|
||||
}
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
return (wxMB2WXbuf)(szOrigString);
|
||||
}
|
||||
@@ -696,26 +697,6 @@ bool wxLocale::AddCatalog(const wxChar *szDomain)
|
||||
// global functions and variables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// translation errors logging
|
||||
// --------------------------
|
||||
|
||||
static bool gs_bGiveTransErrors = TRUE;
|
||||
|
||||
void wxSuppressTransErrors()
|
||||
{
|
||||
gs_bGiveTransErrors = FALSE;
|
||||
}
|
||||
|
||||
void wxRestoreTransErrors()
|
||||
{
|
||||
gs_bGiveTransErrors = TRUE;
|
||||
}
|
||||
|
||||
bool wxIsLoggingTransErrors()
|
||||
{
|
||||
return gs_bGiveTransErrors;
|
||||
}
|
||||
|
||||
// retrieve/change current locale
|
||||
// ------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user