[ENHANCEMENT] Enhance the localization system - main menu entries.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@951 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-09-03 17:42:52 +00:00
parent caaaef7c26
commit 755774861e
2 changed files with 42 additions and 16 deletions

View File

@ -6,15 +6,25 @@
<Main>
<!-- Main Menu Entries -->
<Entries>
<Item id="0" name="&amp;Fichier"/>
<Item id="1" name="&amp;Édition"/>
<Item id="2" name="&amp;Recherche"/>
<Item id="3" name="&amp;Affichage"/>
<Item id="4" name="E&amp;ncodage"/>
<Item id="5" name="&amp;Langage"/>
<Item id="6" name="&amp;Paramétrage"/>
<Item id="7" name="&amp;Macro"/>
<Item id="8" name="E&amp;xécution"/>
<!--Item id="0" name="&amp;Fichier"/-->
<Item menuId="file" name="&amp;Fichier"/>
<!--Item id="1" name="&amp;Édition"/-->
<Item menuId="edit" name="&amp;Édition"/>
<!--Item id="2" name="&amp;Recherche"/-->
<Item menuId="search" name="&amp;Recherche"/>
<!--Item id="3" name="&amp;Affichage"/-->
<Item menuId="view" name="&amp;Affichage"/>
<!--Item id="4" name="E&amp;ncodage"/-->
<Item menuId="encoding" name="E&amp;ncodage"/>
<!--Item id="5" name="&amp;Langage"/-->
<Item menuId="language" name="&amp;Langage"/>
<!--Item id="6" name="&amp;Paramétrage"/-->
<Item menuId="settings" name="&amp;Paramétrage"/>
<!--Item id="7" name="&amp;Macro"/-->
<Item menuId="macro" name="&amp;Macro"/>
<!--Item id="8" name="E&amp;xécution"/-->
<Item menuId="run" name="E&amp;xécution"/>
<Item idName="Plugins" name="&amp;Compléments"/>
<Item idName="Window" name="&amp;Documents"/>
</Entries>

View File

@ -161,8 +161,18 @@ struct MenuPosition {
MenuPosition menuPos[] = {
//==============================================
// { x, y, z, id},
// {L0, L1, L2, id},
//==============================================
{ 0, -1, -1, "file"},
{ 1, -1, -1, "edit"},
{ 2, -1, -1, "search"},
{ 3, -1, -1, "view"},
{ 4, -1, -1, "encoding"},
{ 5, -1, -1, "language"},
{ 6, -1, -1, "settings"},
{ 7, -1, -1, "macro"},
{ 8, -1, -1, "run"},
{ 0, 19, -1, "file-recentFiles"},
{ 1, 9, -1, "edit-copyToClipboard"},
@ -240,17 +250,23 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
if (element->Attribute("id", &id))
//int id;
const char *menuIdStr = element->Attribute("menuId");
//if (element->Attribute("id", &id))
if (menuIdStr)
{
const char *name = element->Attribute("name");
MenuPosition & menuPos = getMenuPosition(menuIdStr);
if (menuPos._x != -1)
{
const char *name = element->Attribute("name");
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::ModifyMenu(menuHandle, id, MF_BYPOSITION, 0, nameW);
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, nameW);
#else
::ModifyMenu(menuHandle, id, MF_BYPOSITION, 0, name);
::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, name);
#endif
}
}
else
{