Reuse the same XRC function for all translations

Translate all strings in the new GetNodeText() function replacing the
old GetText() which was mostly used for translatable strings before --
except that <item> tag contents didn't use it because it also performed
string unescaping, not wanted for the control items, in addition to
translation.

Replace the old GetText() (while still keeping it for compatibility,
i.e. to avoid breaking any custom XRC handlers using it) with the new
function which is more flexible and can be used for all tags.

No real changes, this is just a refactoring.
This commit is contained in:
Vadim Zeitlin
2018-01-11 00:57:02 +01:00
parent 689704119a
commit 52635cfc10
11 changed files with 96 additions and 107 deletions

View File

@@ -513,7 +513,10 @@ public:
// - replaces \n, \r, \t by respective chars (according to C syntax)
// - replaces _ by & and __ by _ (needed for _File => &File because of XML)
// - calls wxGetTranslations (unless disabled in wxXmlResource)
wxString GetText(const wxString& param, bool translate = true) wxOVERRIDE;
//
// The first two conversions can be disabled by using wxXRC_TEXT_NO_ESCAPE
// in flags and the last one -- by using wxXRC_TEXT_NO_TRANSLATE.
wxString GetNodeText(const wxXmlNode *node, int flags = 0) wxOVERRIDE;
// Returns the XRCID.
int GetID() wxOVERRIDE;