From: Václav Slavík Date: Sun, 7 Jul 2013 13:42:27 +0000 (+0000) Subject: Improve translations lookup logging. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/92d609f4b623e38bf202cacc842a616250886faf Improve translations lookup logging. Log match directory in GetAvailableTranslations(). Log search paths with one directory per line, for better readability when debugging. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 00350928a5..518713c743 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -101,6 +101,13 @@ void LogTraceArray(const char *prefix, const wxArrayString& arr) wxLogTrace(TRACE_I18N, "%s: [%s]", prefix, wxJoin(arr, ',')); } +void LogTraceLargeArray(const char *prefix, const wxArrayString& arr) +{ + wxLogTrace(TRACE_I18N, "%s:", prefix); + for ( wxArrayString::const_iterator i = arr.begin(); i != arr.end(); ++i ) + wxLogTrace(TRACE_I18N, " %s", *i); +} + // Use locale-based detection as a fallback wxString GetPreferredUILanguageFallback(const wxArrayString& WXUNUSED(available)) { @@ -1871,8 +1878,11 @@ wxMsgCatalog *wxFileTranslationsLoader::LoadCatalog(const wxString& domain, { wxString searchPath = GetFullSearchPath(lang); - wxLogTrace(TRACE_I18N, wxS("Looking for \"%s.mo\" in search path \"%s\""), - domain, searchPath); + LogTraceLargeArray + ( + wxString::Format("looking for \"%s.mo\" in search path", domain), + wxSplit(searchPath, wxPATH_SEP[0]) + ); wxFileName fn(domain); fn.SetExt(wxS("mo")); @@ -1894,9 +1904,11 @@ wxArrayString wxFileTranslationsLoader::GetAvailableTranslations(const wxString& wxArrayString langs; const wxArrayString prefixes = GetSearchPrefixes(); - wxLogTrace(TRACE_I18N, - "looking for available translations of \"%s\" in search path \"%s\"", - domain, wxJoin(prefixes, wxPATH_SEP[0])); + LogTraceLargeArray + ( + wxString::Format("looking for available translations of \"%s\" in search path", domain), + prefixes + ); for ( wxArrayString::const_iterator i = prefixes.begin(); i != prefixes.end(); @@ -1923,7 +1935,8 @@ wxArrayString wxFileTranslationsLoader::GetAvailableTranslations(const wxString& #endif // __WXOSX__ wxLogTrace(TRACE_I18N, - "found %s translation of \"%s\"", lang, domain); + "found %s translation of \"%s\" in %s", + lang, domain, langdir); langs.push_back(lang); } }