{ // translate all text items in the given dialog\r
int i=0, j, k;\r
char buf[MSG_SIZ], *s;\r
-//if(appData.debugMode) fprintf(debugFP, "Translate(%d)\n", dialogID);\r
if(!barbaric) return;\r
while(dialogItems[i][0] && dialogItems[i][0] != dialogID) i++; // find the dialog description\r
if(dialogItems[i][0] != dialogID) return; // unknown dialog, should not happen\r
GetWindowText( hDlg, buf, MSG_SIZ );\r
s = T_(buf);\r
-//if(appData.debugMode) fprintf(debugFP, "WindowText '%s' -> '%s'\n", buf, s);\r
if(strcmp(buf, s)) SetWindowText(hDlg, s); // replace by translated string (if different)\r
for(j=1; k=dialogItems[i][j]; j++) { // translate all listed dialog items\r
GetDlgItemText(hDlg, k, buf, MSG_SIZ);\r
}\r
}\r
\r
+HMENU\r
+TranslateOneMenu(int i, HMENU subMenu)\r
+{\r
+ int j;\r
+ static MENUITEMINFO info;\r
+\r
+ info.cbSize = sizeof(MENUITEMINFO);\r
+ info.fMask = MIIM_STATE | MIIM_TYPE;\r
+ for(j=GetMenuItemCount(subMenu)-1; j>=0; j--){\r
+ char buf[MSG_SIZ];\r
+ info.dwTypeData = buf;\r
+ info.cch = sizeof(buf);\r
+ GetMenuItemInfo(subMenu, j, TRUE, &info);\r
+ if(i < 10) {
+ if(menuText[i][j]) safeStrCpy(buf, menuText[i][j], sizeof(buf)/sizeof(buf[0]) );\r
+ else menuText[i][j] = strdup(buf); // remember original on first change\r
+ }\r
+ if(buf[0] == NULLCHAR) continue;\r
+ info.dwTypeData = T_(buf);\r
+ info.cch = strlen(buf)+1;\r
+ SetMenuItemInfo(subMenu, j, TRUE, &info);\r
+ }\r
+ return subMenu;\r
+}\r
+\r
void\r
TranslateMenus(int addLanguage)\r
{\r
- int i, j;\r
+ int i;\r
WIN32_FIND_DATA fileData;\r
HANDLE hFind;\r
#define IDM_English 1895\r
HMENU subMenu = GetSubMenu(mainMenu, i);\r
ModifyMenu(mainMenu, i, MF_STRING|MF_BYPOSITION|MF_POPUP|EnableMenuItem(mainMenu, i, MF_BYPOSITION),\r
(UINT) subMenu, T_(menuBarText[tinyLayout][i]));\r
- for(j=GetMenuItemCount(subMenu)-1; j>=0; j--){\r
- char buf[MSG_SIZ];\r
- UINT k = GetMenuItemID(subMenu, j);\r
- if(menuText[i][j])
- safeStrCpy(buf, menuText[i][j], sizeof(buf)/sizeof(buf[0]) ); else {\r
- GetMenuString(subMenu, j, buf, MSG_SIZ, MF_BYPOSITION);\r
- menuText[i][j] = strdup(buf); // remember original on first change\r
- }\r
- if(buf[0] == NULLCHAR) continue;\r
-//fprintf(debugFP, "menu(%d,%d) = %s (%08x, %08x) %d\n", i, j, buf, mainMenu, subMenu, k);\r
- ModifyMenu(subMenu, j, MF_STRING|MF_BYPOSITION\r
- |CheckMenuItem(subMenu, j, MF_BYPOSITION)\r
- |EnableMenuItem(subMenu, j, MF_BYPOSITION), k, T_(buf));\r
- }\r
+ TranslateOneMenu(i, subMenu);\r
}\r
DrawMenuBar(hwndMain);\r
}\r
* menu that TrackPopupMenu displays.\r
*/\r
hmenuTrackPopup = GetSubMenu(hmenu, 0);\r
+ TranslateOneMenu(10, hmenuTrackPopup);\r
\r
SetMenuDefaultItem(hmenuTrackPopup, def, FALSE);\r
\r