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
29 CHAR STRING_MAIN_WIN_CLASS_NAME[] = "PMMain";
30 CHAR STRING_MDI_WIN_CLASS_NAME[] = "MDICLIENT";
31 CHAR STRING_GROUP_WIN_CLASS_NAME[] = "PMGroup";
32 CHAR STRING_PROGRAM_WIN_CLASS_NAME[] = "PMProgram";
35 /* Xx will be overwritten with En, ... */
36 CHAR STRING_ACCEL[] = "ACCEL";
37 CHAR STRING_MENU_Xx[] = "MENU_Xx";
38 CHAR STRING_NEW_Xx[] = "DIALOG_NEW_Xx";
39 CHAR STRING_OPEN_Xx[] = "DIALOG_OPEN_Xx";
40 CHAR STRING_MOVE_Xx[] = "DIALOG_MOVE_Xx";
41 CHAR STRING_COPY_Xx[] = "DIALOG_COPY_Xx";
42 CHAR STRING_DELETE_Xx[] = "DIALOG_DELETE_Xx";
43 CHAR STRING_GROUP_Xx[] = "DIALOG_GROUP_Xx";
44 CHAR STRING_PROGRAM_Xx[] = "DIALOG_PROGRAM_Xx";
45 CHAR STRING_SYMBOL_Xx[] = "DIALOG_SYMBOL_Xx";
46 CHAR STRING_EXECUTE_Xx[] = "DIALOG_EXECUTE_Xx";
48 static BOOL STRING_LoadStringOtherLanguage(UINT num, UINT ids, LPSTR str, UINT len)
50 ids -= Globals.wStringTableOffset;
52 return(LoadString(Globals.hInstance, ids, str, len));
55 VOID STRING_SelectLanguageByName(LPCSTR lang)
60 for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
61 if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)) &&
62 !lstrcmp(lang, newlang))
64 STRING_SelectLanguageByNumber(i);
69 for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
70 if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)))
72 STRING_SelectLanguageByNumber(i);
76 MessageBox(Globals.hMainWnd, "No language found", "FATAL ERROR", MB_OK);
80 VOID STRING_SelectLanguageByNumber(UINT num)
84 CHAR caption[MAX_STRING_LEN];
85 CHAR item[MAX_STRING_LEN];
88 /* Select string table */
89 Globals.wStringTableOffset = num * 0x100;
92 LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
93 Globals.lpszLanguage = lang;
95 /* Set frame caption */
96 LoadString(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
97 SetWindowText(Globals.hMainWnd, caption);
99 /* Change Resource names */
100 lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, lang, 3);
101 lstrcpyn(STRING_NEW_Xx + sizeof(STRING_NEW_Xx) - 3, lang, 3);
102 lstrcpyn(STRING_OPEN_Xx + sizeof(STRING_OPEN_Xx) - 3, lang, 3);
103 lstrcpyn(STRING_MOVE_Xx + sizeof(STRING_MOVE_Xx) - 3, lang, 3);
104 lstrcpyn(STRING_COPY_Xx + sizeof(STRING_COPY_Xx) - 3, lang, 3);
105 lstrcpyn(STRING_DELETE_Xx + sizeof(STRING_DELETE_Xx) - 3, lang, 3);
106 lstrcpyn(STRING_GROUP_Xx + sizeof(STRING_GROUP_Xx) - 3, lang, 3);
107 lstrcpyn(STRING_PROGRAM_Xx + sizeof(STRING_PROGRAM_Xx) - 3, lang, 3);
108 lstrcpyn(STRING_SYMBOL_Xx + sizeof(STRING_SYMBOL_Xx) - 3, lang, 3);
109 lstrcpyn(STRING_EXECUTE_Xx + sizeof(STRING_EXECUTE_Xx) - 3, lang, 3);
112 hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx);
113 Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
114 Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
115 Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
116 Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
118 /* Remove dummy item */
119 RemoveMenu(Globals.hLanguageMenu, 0, MF_BYPOSITION);
120 /* Add language items */
121 for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
122 if (STRING_LoadStringOtherLanguage(i, IDS_LANGUAGE_MENU_ITEM, item, sizeof(item)))
123 AppendMenu(Globals.hLanguageMenu, MF_STRING | MF_BYCOMMAND,
124 PM_FIRST_LANGUAGE + i, item);
127 SendMessage(Globals.hMDIWnd, WM_MDISETMENU,
129 (LPARAM) Globals.hWindowsMenu);
130 else SetMenu(Globals.hMainWnd, hMainMenu);
132 /* Destroy old menu */
133 if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
134 Globals.hMainMenu = hMainMenu;
137 /* Local Variables: */
138 /* c-file-style: "GNU" */