From e1983b4cac3460b7d5db8d2020f549e156b3127f Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 15 Feb 2011 19:13:33 +0100 Subject: [PATCH] Make language choice from menu persistent Set appData.language to the chosen language file, or empty if English is chosen, so that the choice is saved with the settings. Increase the number of possible language choices from 5 to 20. (After all, we already have 7 now!) --- winboard/winboard.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/winboard/winboard.c b/winboard/winboard.c index b76a358..34832f0 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -345,6 +345,7 @@ LoadLanguageFile(char *name) if(!name || name[0] == NULLCHAR) return; snprintf(buf, MSG_SIZ, "%s%s", name, strchr(name, '.') ? "" : ".lng"); // auto-append lng extension + appData.language = oldLanguage; if(!strcmp(buf, oldLanguage)) { barbaric = 1; return; } // this language already loaded; just switch on if((f = fopen(buf, "r")) == NULL) return; while((k = fgetc(f)) != EOF) { @@ -443,7 +444,7 @@ TranslateMenus(int addLanguage) int i; WIN32_FIND_DATA fileData; HANDLE hFind; -#define IDM_English 1895 +#define IDM_English 1970 if(1) { HMENU mainMenu = GetMenu(hwndMain); for (i=GetMenuItemCount(mainMenu)-1; i>=0; i--) { @@ -5383,7 +5384,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_English: - barbaric = 0; + barbaric = 0; appData.language = ""; TranslateMenus(0); CheckMenuItem(GetMenu(hwndMain), lastChecked, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(GetMenu(hwndMain), IDM_English, MF_BYCOMMAND|MF_CHECKED); @@ -5391,7 +5392,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; default: - if(wmId > IDM_English && wmId < IDM_English+5) { + if(wmId > IDM_English && wmId < IDM_English+20) { LoadLanguageFile(languageFile[wmId - IDM_English - 1]); TranslateMenus(0); CheckMenuItem(GetMenu(hwndMain), lastChecked, MF_BYCOMMAND|MF_UNCHECKED); -- 1.7.0.4