4 * Copyright 1996 Ulrich Schmid
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 CHAR STRING_MAIN_WIN_CLASS_NAME
[] = "PMMain";
27 CHAR STRING_MDI_WIN_CLASS_NAME
[] = "MDICLIENT";
28 CHAR STRING_GROUP_WIN_CLASS_NAME
[] = "PMGroup";
29 CHAR STRING_PROGRAM_WIN_CLASS_NAME
[] = "PMProgram";
32 /* Xx will be overwritten with En, ... */
33 CHAR STRING_ACCEL
[] = "ACCEL";
34 CHAR STRING_MENU_Xx
[] = "MENU_Xx";
35 CHAR STRING_NEW_Xx
[] = "DIALOG_NEW_Xx";
36 CHAR STRING_OPEN_Xx
[] = "DIALOG_OPEN_Xx";
37 CHAR STRING_MOVE_Xx
[] = "DIALOG_MOVE_Xx";
38 CHAR STRING_COPY_Xx
[] = "DIALOG_COPY_Xx";
39 CHAR STRING_DELETE_Xx
[] = "DIALOG_DELETE_Xx";
40 CHAR STRING_GROUP_Xx
[] = "DIALOG_GROUP_Xx";
41 CHAR STRING_PROGRAM_Xx
[] = "DIALOG_PROGRAM_Xx";
42 CHAR STRING_SYMBOL_Xx
[] = "DIALOG_SYMBOL_Xx";
43 CHAR STRING_EXECUTE_Xx
[] = "DIALOG_EXECUTE_Xx";
45 static BOOL
STRING_LoadStringOtherLanguage(UINT num
, UINT ids
, LPSTR str
, UINT len
)
47 ids
-= Globals
.wStringTableOffset
;
49 return(LoadString(Globals
.hInstance
, ids
, str
, len
));
52 VOID
STRING_SelectLanguageByName(LPCSTR lang
)
57 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
58 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_ID
, newlang
, sizeof(newlang
)) &&
59 !lstrcmp(lang
, newlang
))
61 STRING_SelectLanguageByNumber(i
);
66 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
67 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_ID
, newlang
, sizeof(newlang
)))
69 STRING_SelectLanguageByNumber(i
);
73 MessageBox(Globals
.hMainWnd
, "No language found", "FATAL ERROR", MB_OK
);
77 VOID
STRING_SelectLanguageByNumber(UINT num
)
81 CHAR caption
[MAX_STRING_LEN
];
82 CHAR item
[MAX_STRING_LEN
];
85 /* Select string table */
86 Globals
.wStringTableOffset
= num
* 0x100;
89 LoadString(Globals
.hInstance
, IDS_LANGUAGE_ID
, lang
, sizeof(lang
));
90 Globals
.lpszLanguage
= lang
;
92 /* Set frame caption */
93 LoadString(Globals
.hInstance
, IDS_PROGRAM_MANAGER
, caption
, sizeof(caption
));
94 SetWindowText(Globals
.hMainWnd
, caption
);
96 /* Change Resource names */
97 lstrcpyn(STRING_MENU_Xx
+ sizeof(STRING_MENU_Xx
) - 3, lang
, 3);
98 lstrcpyn(STRING_NEW_Xx
+ sizeof(STRING_NEW_Xx
) - 3, lang
, 3);
99 lstrcpyn(STRING_OPEN_Xx
+ sizeof(STRING_OPEN_Xx
) - 3, lang
, 3);
100 lstrcpyn(STRING_MOVE_Xx
+ sizeof(STRING_MOVE_Xx
) - 3, lang
, 3);
101 lstrcpyn(STRING_COPY_Xx
+ sizeof(STRING_COPY_Xx
) - 3, lang
, 3);
102 lstrcpyn(STRING_DELETE_Xx
+ sizeof(STRING_DELETE_Xx
) - 3, lang
, 3);
103 lstrcpyn(STRING_GROUP_Xx
+ sizeof(STRING_GROUP_Xx
) - 3, lang
, 3);
104 lstrcpyn(STRING_PROGRAM_Xx
+ sizeof(STRING_PROGRAM_Xx
) - 3, lang
, 3);
105 lstrcpyn(STRING_SYMBOL_Xx
+ sizeof(STRING_SYMBOL_Xx
) - 3, lang
, 3);
106 lstrcpyn(STRING_EXECUTE_Xx
+ sizeof(STRING_EXECUTE_Xx
) - 3, lang
, 3);
109 hMainMenu
= LoadMenu(Globals
.hInstance
, STRING_MENU_Xx
);
110 Globals
.hFileMenu
= GetSubMenu(hMainMenu
, 0);
111 Globals
.hOptionMenu
= GetSubMenu(hMainMenu
, 1);
112 Globals
.hWindowsMenu
= GetSubMenu(hMainMenu
, 2);
113 Globals
.hLanguageMenu
= GetSubMenu(hMainMenu
, 3);
115 /* Remove dummy item */
116 RemoveMenu(Globals
.hLanguageMenu
, 0, MF_BYPOSITION
);
117 /* Add language items */
118 for (i
= 0; i
<= MAX_LANGUAGE_NUMBER
; i
++)
119 if (STRING_LoadStringOtherLanguage(i
, IDS_LANGUAGE_MENU_ITEM
, item
, sizeof(item
)))
120 AppendMenu(Globals
.hLanguageMenu
, MF_STRING
| MF_BYCOMMAND
,
121 PM_FIRST_LANGUAGE
+ i
, item
);
124 SendMessage(Globals
.hMDIWnd
, WM_MDISETMENU
,
126 (LPARAM
) Globals
.hWindowsMenu
);
127 else SetMenu(Globals
.hMainWnd
, hMainMenu
);
129 /* Destroy old menu */
130 if (Globals
.hMainMenu
) DestroyMenu(Globals
.hMainMenu
);
131 Globals
.hMainMenu
= hMainMenu
;
134 /* Local Variables: */
135 /* c-file-style: "GNU" */