From 718cf16095911aff708013e3615ee56f6b730313 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 3 Mar 2002 23:25:58 +0000 Subject: [PATCH] fixed translatable strings handling in XRC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/xrc/xmlres.cpp | 19 +++++++++---------- src/xrc/xmlres.cpp | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 8a630df247..dda368212b 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -633,19 +633,14 @@ int wxXmlResourceHandler::GetStyle(const wxString& param, int defaults) wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) { - wxString str1; + wxString str1(GetParamValue(param)); wxString str2; const wxChar *dt; wxChar amp_char; - if (translate && m_resource->GetFlags() & wxXRC_USE_LOCALE) - str1 = wxGetTranslation(GetParamValue(param)); - else - str1 = GetParamValue(param); - - // VS: First version of XRC resources used $ instead of & (which is illegal in XML), - // but later I realized that '_' fits this purpose much better (because - // &File means "File with F underlined"). + // VS: First version of XRC resources used $ instead of & (which is + // illegal in XML), but later I realized that '_' fits this purpose + // much better (because &File means "File with F underlined"). if (m_resource->CompareVersion(2,3,0,1) < 0) amp_char = wxT('$'); else @@ -674,7 +669,11 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) else str2 << *dt; } - return str2; + if (translate && m_resource->GetFlags() & wxXRC_USE_LOCALE) + return wxGetTranslation(str2); + else + return str2; + } diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 8a630df247..dda368212b 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -633,19 +633,14 @@ int wxXmlResourceHandler::GetStyle(const wxString& param, int defaults) wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) { - wxString str1; + wxString str1(GetParamValue(param)); wxString str2; const wxChar *dt; wxChar amp_char; - if (translate && m_resource->GetFlags() & wxXRC_USE_LOCALE) - str1 = wxGetTranslation(GetParamValue(param)); - else - str1 = GetParamValue(param); - - // VS: First version of XRC resources used $ instead of & (which is illegal in XML), - // but later I realized that '_' fits this purpose much better (because - // &File means "File with F underlined"). + // VS: First version of XRC resources used $ instead of & (which is + // illegal in XML), but later I realized that '_' fits this purpose + // much better (because &File means "File with F underlined"). if (m_resource->CompareVersion(2,3,0,1) < 0) amp_char = wxT('$'); else @@ -674,7 +669,11 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) else str2 << *dt; } - return str2; + if (translate && m_resource->GetFlags() & wxXRC_USE_LOCALE) + return wxGetTranslation(str2); + else + return str2; + } -- 2.45.2