X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5ed345b7edec3552c51b3cf9453a81b29568e946..012a01fc1ea0f4c870eaf66bb332617affa5abd0:/contrib/src/xrc/xmlres.cpp diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index ef68779356..dda368212b 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -331,7 +331,7 @@ void wxXmlResource::UpdateResources() delete m_data[i].Doc; m_data[i].Doc = new wxXmlDocument; } - if (!stream || !m_data[i].Doc->Load(*stream, wxXML_IO_AUTO, encoding)) + if (!stream || !m_data[i].Doc->Load(*stream, encoding)) { wxLogError(_("Cannot load resources from file '%s'."), m_data[i].File.c_str()); @@ -631,21 +631,16 @@ int wxXmlResourceHandler::GetStyle(const wxString& param, int defaults) -wxString wxXmlResourceHandler::GetText(const wxString& param) +wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) { - wxString str1; + wxString str1(GetParamValue(param)); wxString str2; const wxChar *dt; wxChar amp_char; - if (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) else str2 << *dt; } - return str2; + if (translate && m_resource->GetFlags() & wxXRC_USE_LOCALE) + return wxGetTranslation(str2); + else + return str2; + }