Browse Source

[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
remotes/trunk
Don Ho 12 years ago
parent
commit
755774861e
  1. 28
      PowerEditor/installer/nativeLang/french.xml
  2. 26
      PowerEditor/src/localization.cpp

28
PowerEditor/installer/nativeLang/french.xml

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

26
PowerEditor/src/localization.cpp

@ -161,8 +161,18 @@ struct MenuPosition {
MenuPosition menuPos[] = { 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"}, { 0, 19, -1, "file-recentFiles"},
{ 1, 9, -1, "edit-copyToClipboard"}, { 1, 9, -1, "edit-copyToClipboard"},
@ -240,18 +250,24 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
childNode = childNode->NextSibling("Item") ) childNode = childNode->NextSibling("Item") )
{ {
TiXmlElementA *element = childNode->ToElement(); TiXmlElementA *element = childNode->ToElement();
int id; //int id;
if (element->Attribute("id", &id)) const char *menuIdStr = element->Attribute("menuId");
//if (element->Attribute("id", &id))
if (menuIdStr)
{
MenuPosition & menuPos = getMenuPosition(menuIdStr);
if (menuPos._x != -1)
{ {
const char *name = element->Attribute("name"); const char *name = element->Attribute("name");
#ifdef UNICODE #ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::ModifyMenu(menuHandle, id, MF_BYPOSITION, 0, nameW); ::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, nameW);
#else #else
::ModifyMenu(menuHandle, id, MF_BYPOSITION, 0, name); ::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, name);
#endif #endif
} }
}
else else
{ {
idName = element->Attribute("idName"); idName = element->Attribute("idName");

Loading…
Cancel
Save