Add wxTranslations::GetTranslatedString().
Replace GetString(), which always returns something (possibly the original string) with GetTranslatedString() that returns either a pointer to translated string or NULL. This simplifies the code a bit, all handling of missing translations is now done in wxGetTranslation(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1618,19 +1618,18 @@ const wxString& wxTranslations::GetUntranslatedString(const wxString& str)
|
||||
}
|
||||
|
||||
|
||||
const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
const wxString& domain) const
|
||||
const wxString *wxTranslations::GetTranslatedString(const wxString& origString,
|
||||
const wxString& domain) const
|
||||
{
|
||||
return GetString(origString, origString, UINT_MAX, domain);
|
||||
return GetTranslatedString(origString, UINT_MAX, domain);
|
||||
}
|
||||
|
||||
const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
const wxString& origString2,
|
||||
unsigned n,
|
||||
const wxString& domain) const
|
||||
const wxString *wxTranslations::GetTranslatedString(const wxString& origString,
|
||||
unsigned n,
|
||||
const wxString& domain) const
|
||||
{
|
||||
if ( origString.empty() )
|
||||
return GetUntranslatedString(origString);
|
||||
return NULL;
|
||||
|
||||
const wxString *trans = NULL;
|
||||
wxMsgCatalog *pMsgCat;
|
||||
@@ -1665,14 +1664,9 @@ const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
(!domain.empty() ? wxString::Format("domain '%s' ", domain) : wxString()),
|
||||
m_lang
|
||||
);
|
||||
|
||||
if (n == UINT_MAX)
|
||||
return GetUntranslatedString(origString);
|
||||
else
|
||||
return GetUntranslatedString(n == 1 ? origString : origString2);
|
||||
}
|
||||
|
||||
return *trans;
|
||||
return trans;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user