From: H.G. Muller Date: Fri, 27 Aug 2010 11:59:09 +0000 (+0200) Subject: Add some forgotten translation hooks X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6a003377fa02454a3d4bf200b5cb11b1dee097fb;p=xboard.git Add some forgotten translation hooks The general-options, file-browse dialogs and the about box did not call Translate() yet. Also translate contents of combo boxes. Some small bug fixes. --- diff --git a/backend.c b/backend.c index f7c75b6..704847e 100644 --- a/backend.c +++ b/backend.c @@ -131,6 +131,7 @@ extern int gettimeofday(struct timeval *, struct timezone *); #ifdef ENABLE_NLS # define _(s) gettext (s) # define N_(s) gettext_noop (s) +# define T_(s) gettext(s) #else # ifdef WIN32 # define _(s) T_(s) @@ -138,6 +139,7 @@ extern int gettimeofday(struct timeval *, struct timezone *); # else # define _(s) (s) # define N_(s) s +# define T_(s) s # endif #endif diff --git a/winboard/winboard.c b/winboard/winboard.c index 243ff29..6fc482e 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -277,7 +277,8 @@ int dialogItems[][40] = { { DLG_Sound, IDC_Event, OPT_NoSound, OPT_DefaultBeep, OPT_BuiltInSound, OPT_WavFile, OPT_BrowseSound, OPT_DefaultSounds, IDOK, IDCANCEL, OPT_PlaySound }, { DLG_GeneralOptions, IDOK, IDCANCEL, OPT_AlwaysOnTop, OPT_HighlightLastMove, - OPT_AlwaysQueen, OPT_PeriodicUpdates, OPT_AnimateDragging, OPT_PonderNextMove, OPT_AnimateMoving, OPT_PopupExitMessage, OPT_AutoFlag, OPT_PopupMoveErrors, + OPT_AlwaysQueen, OPT_PeriodicUpdates, OPT_AnimateDragging, OPT_PonderNextMove, + OPT_AnimateMoving, OPT_PopupExitMessage, OPT_AutoFlag, OPT_PopupMoveErrors, OPT_AutoFlipView, OPT_ShowButtonBar, OPT_AutoRaiseBoard, OPT_ShowCoordinates, OPT_Blindfold, OPT_ShowThinking, OPT_HighlightDragging, OPT_TestLegality, OPT_SaveExtPGN, OPT_HideThinkFromHuman, OPT_ExtraInfoInMoveHistory, @@ -351,7 +352,7 @@ LoadLanguageFile(char *name) if(j >= sizeof(english)) { DisplayError("Too many translated strings", 0); return; } english[j] = languageBuf + n + 1; *p = 0; foreign[j++] = p + 7; languageBuf[i-1] = 0; -if(appData.debugMode) fprintf(debugFP, "translation: replace '%s' by '%s'\n", english[j-1], foreign[j-1]); +//if(appData.debugMode) fprintf(debugFP, "translation: replace '%s' by '%s'\n", english[j-1], foreign[j-1]); } } } @@ -368,7 +369,7 @@ if(appData.debugMode) fprintf(debugFP, "translation: replace '%s' by '%s'\n", en } fclose(f); barbaric = (j != 0); - if(barbaric) strcpy(oldLanguage, name); else oldLanguage[0] = NULLCHAR; + strcpy(oldLanguage, buf); } char * @@ -387,7 +388,7 @@ if(appData.debugMode) fprintf(debugFP, "T_(%s)\n", s); } void -Translate(HANDLE hDlg, int dialogID) +Translate(HWND hDlg, int dialogID) { // translate all text items in the given dialog int i=0, j, k; char buf[MSG_SIZ], *s; @@ -5603,6 +5604,7 @@ OldOpenFileHook(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) number = NULL; } CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER)); + Translate(hDlg, 1536); return FALSE; /* Allow for further processing */ case WM_COMMAND: @@ -5622,6 +5624,7 @@ OpenFileHook(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) OFNOTIFY *ofnot; switch (uiMsg) { case WM_INITDIALOG: + Translate(hdlg, DLG_IndexNumber); ofname = (OPENFILENAME *)lParam; number = (UINT *)(ofname->lCustData); break; @@ -5851,7 +5854,7 @@ InitComboStrings(HANDLE hwndCombo, char **cd) SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0); while (*cd != NULL) { - SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) *cd); + SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) T_(*cd)); cd++; } } @@ -6067,6 +6070,7 @@ About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Center the dialog over the application window */ CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER)); SetDlgItemText(hDlg, ABOUTBOX_Version, programVersion); + Translate(hDlg, ABOUTBOX); JAWS_COPYRIGHT return (TRUE); diff --git a/winboard/woptions.c b/winboard/woptions.c index 4c2721e..dd0b443 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -159,6 +159,7 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* Center the dialog over the application window */ CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER)); + Translate(hDlg, DLG_GeneralOptions); /* Initialize the dialog items */ #define CHECK_BOX(x,y) CheckDlgButton(hDlg, (x), (BOOL)(y)) @@ -1081,7 +1082,7 @@ ColorizeTextDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* set the background color */ SendDlgItemMessage(hDlg, OPT_Sample, EM_SETBKGNDCOLOR, FALSE, background); - SetDlgItemText(hDlg, OPT_Sample, mca.name); + SetDlgItemText(hDlg, OPT_Sample, T_(mca.name)); UpdateSampleText(hDlg, OPT_Sample, &mca); return TRUE; @@ -1219,16 +1220,16 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hDlg, OPT_SampleSeek, EM_SETBKGNDCOLOR, 0, cbc); SendDlgItemMessage(hDlg, OPT_SampleNormal, EM_SETBKGNDCOLOR, 0, cbc); - SetDlgItemText(hDlg, OPT_SampleShout, mca[ColorShout].name); - SetDlgItemText(hDlg, OPT_SampleSShout, mca[ColorSShout].name); - SetDlgItemText(hDlg, OPT_SampleChannel1, mca[ColorChannel1].name); - SetDlgItemText(hDlg, OPT_SampleChannel, mca[ColorChannel].name); - SetDlgItemText(hDlg, OPT_SampleKibitz, mca[ColorKibitz].name); - SetDlgItemText(hDlg, OPT_SampleTell, mca[ColorTell].name); - SetDlgItemText(hDlg, OPT_SampleChallenge, mca[ColorChallenge].name); - SetDlgItemText(hDlg, OPT_SampleRequest, mca[ColorRequest].name); - SetDlgItemText(hDlg, OPT_SampleSeek, mca[ColorSeek].name); - SetDlgItemText(hDlg, OPT_SampleNormal, mca[ColorNormal].name); + SetDlgItemText(hDlg, OPT_SampleShout, T_(mca[ColorShout].name)); + SetDlgItemText(hDlg, OPT_SampleSShout, T_(mca[ColorSShout].name)); + SetDlgItemText(hDlg, OPT_SampleChannel1, T_(mca[ColorChannel1].name)); + SetDlgItemText(hDlg, OPT_SampleChannel, T_(mca[ColorChannel].name)); + SetDlgItemText(hDlg, OPT_SampleKibitz, T_(mca[ColorKibitz].name)); + SetDlgItemText(hDlg, OPT_SampleTell, T_(mca[ColorTell].name)); + SetDlgItemText(hDlg, OPT_SampleChallenge, T_(mca[ColorChallenge].name)); + SetDlgItemText(hDlg, OPT_SampleRequest, T_(mca[ColorRequest].name)); + SetDlgItemText(hDlg, OPT_SampleSeek, T_(mca[ColorSeek].name)); + SetDlgItemText(hDlg, OPT_SampleNormal, T_(mca[ColorNormal].name)); UpdateSampleText(hDlg, OPT_SampleShout, &mca[ColorShout]); UpdateSampleText(hDlg, OPT_SampleSShout, &mca[ColorSShout]); @@ -1793,7 +1794,7 @@ InitSoundCombo(HWND hwndCombo, SoundComboData *scd) /* send the labels to the combo box */ while (scd->label) { - err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) scd->label); + err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) T_(scd->label)); if (err != cnt++) { sprintf(buf, "InitSoundCombo(): err '%d', cnt '%d'\n", (int)err, (int)cnt);