Translate menu accelerators from XRC

The content of <accel> property was taken verbatim and appended to the
(translated) label; this bypassed wx's internal accelerators translation
mechanism, because wxMenuItem code quite reasonably assumes that the
string passed to it is translated.

Explicitly use SetAccel() instead, to force translation. This matters
for languages such as German where e.g. Ctrl+ is translated as Strg+.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2014-11-25 19:05:04 +00:00
parent 2568dec27f
commit 4509ef837d

View File

@@ -79,9 +79,6 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
int id = GetID();
wxString label = GetText(wxT("label"));
wxString accel = GetText(wxT("accel"), false);
wxString fullLabel = label;
if (!accel.empty())
fullLabel << wxT("\t") << accel;
wxItemKind kind = wxITEM_NORMAL;
if (GetBool(wxT("radio")))
@@ -100,8 +97,16 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
kind = wxITEM_CHECK;
}
wxMenuItem *mitem = new wxMenuItem(p_menu, id, fullLabel,
wxMenuItem *mitem = new wxMenuItem(p_menu, id, label,
GetText(wxT("help")), kind);
if (!accel.empty())
{
wxAcceleratorEntry *entry = new wxAcceleratorEntry();
if (entry->FromString(accel))
mitem->SetAccel(entry);
else
delete entry;
}
#if (!defined(__WXMSW__) && !defined(__WXPM__)) || wxUSE_OWNER_DRAWN
if (HasParam(wxT("bitmap")))