Mark XBoard result messages for internationalization
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 23 Aug 2010 10:48:07 +0000 (12:48 +0200)
committerArun Persaud <arun@nubati.net>
Wed, 1 Sep 2010 05:11:33 +0000 (22:11 -0700)
The GNU gettext macro _() is used with the game-end messages. This might
be controversial, as they will appear in the PGN as well. But only as a
comment. We can always decide not to supply a translation.

backend.c
frontend.h
winboard/winboard.h
winboard/wsettings.c

index 92df2bb..8a2a8d8 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -6716,7 +6716,7 @@ Adjudicate(ChessProgramState *cps)
                           SendMoveToProgram(forwardMostMove-1, engineOpponent); // make sure opponent gets move
                          ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
                          GameEnds( WhiteOnMove(forwardMostMove) ? BlackWins : WhiteWins, 
-                                                       "Xboard adjudication: King destroyed", GE_XBOARD );
+                                                       _("Xboard adjudication: King destroyed"), GE_XBOARD );
                          return 1;
                     }
                }
@@ -6730,7 +6730,7 @@ Adjudicate(ChessProgramState *cps)
                           SendMoveToProgram(forwardMostMove-1, engineOpponent); // make sure opponent gets to see move
                          ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
                          GameEnds( WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins, 
-                                                       "Xboard adjudication: Bare king", GE_XBOARD );
+                                                       _("Xboard adjudication: Bare king"), GE_XBOARD );
                          return 1;
                     }
                  } else
@@ -6743,7 +6743,7 @@ Adjudicate(ChessProgramState *cps)
                              SendMoveToProgram(forwardMostMove-1, engineOpponent); // make sure opponent gets move
                            ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
                            GameEnds( nrW > 1 ? WhiteWins : nrB > 1 ? BlackWins : GameIsDrawn, 
-                                                       "Xboard adjudication: Bare king", GE_XBOARD );
+                                                       _("Xboard adjudication: Bare king"), GE_XBOARD );
                            return 1;
                        }
                  }
@@ -6759,7 +6759,7 @@ Adjudicate(ChessProgramState *cps)
                        if(MateTest(boards[i], PosFlags(i)) == MT_CHECK)
                            checkCnt++;
                        if(checkCnt >= 2) {
-                           reason = "Xboard adjudication: 3rd check";
+                           reason = _("Xboard adjudication: 3rd check");
                            boards[forwardMostMove][EP_STATUS] = EP_CHECKMATE;
                            break;
                        }
@@ -6770,7 +6770,7 @@ Adjudicate(ChessProgramState *cps)
                break;
              case MT_STALEMATE:
              case MT_STAINMATE:
-               reason = "Xboard adjudication: Stalemate";
+               reason = _("Xboard adjudication: Stalemate");
                if((signed char)boards[forwardMostMove][EP_STATUS] != EP_CHECKMATE) { // [HGM] don't touch win through baring or K-capt
                    boards[forwardMostMove][EP_STATUS] = EP_STALEMATE;   // default result for stalemate is draw
                    if(gameInfo.variant == VariantLosers  || gameInfo.variant == VariantGiveaway) // [HGM] losers:
@@ -6784,7 +6784,7 @@ Adjudicate(ChessProgramState *cps)
                }
                break;
              case MT_CHECKMATE:
-               reason = "Xboard adjudication: Checkmate";
+               reason = _("Xboard adjudication: Checkmate");
                boards[forwardMostMove][EP_STATUS] = (gameInfo.variant == VariantLosers ? EP_WINS : EP_CHECKMATE);
                break;
            }
@@ -6822,7 +6822,7 @@ Adjudicate(ChessProgramState *cps)
                           SendMoveToProgram(forwardMostMove-1, engineOpponent); /* make sure opponent gets to see last move */
                         }
                          ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
-                         GameEnds( GameIsDrawn, "Xboard adjudication: Insufficient mating material", GE_XBOARD );
+                         GameEnds( GameIsDrawn, _("Xboard adjudication: Insufficient mating material"), GE_XBOARD );
                          return 1;
                      }
                 }
@@ -6843,7 +6843,7 @@ Adjudicate(ChessProgramState *cps)
                            SendMoveToProgram(forwardMostMove-1, engineOpponent); /* make sure opponent gets to see move */
                          }
                           ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
-                          GameEnds( GameIsDrawn, "Xboard adjudication: Trivial draw", GE_XBOARD );
+                          GameEnds( GameIsDrawn, _("Xboard adjudication: Trivial draw"), GE_XBOARD );
                           return 1;
                      }
                 } else moveCount = 6;
@@ -6891,7 +6891,7 @@ Adjudicate(ChessProgramState *cps)
                             && appData.drawRepeats > 1) {
                              /* adjudicate after user-specified nr of repeats */
                             int result = GameIsDrawn;
-                            char *details = "XBoard adjudication: repetition draw";
+                            char *details = _("XBoard adjudication: repetition draw");
                             if(gameInfo.variant == VariantXiangqi && appData.testLegality) { 
                                // [HGM] xiangqi: check for forbidden perpetuals
                                int m, ourPerpetual = 1, hisPerpetual = 1;
@@ -6905,7 +6905,7 @@ Adjudicate(ChessProgramState *cps)
                                                                        ourPerpetual, hisPerpetual);
                                if(ourPerpetual && !hisPerpetual) { // we are actively checking him: forfeit
                                    result = WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins;
-                                   details = "Xboard adjudication: perpetual checking";
+                                   details = _("Xboard adjudication: perpetual checking");
                                } else
                                if(hisPerpetual && !ourPerpetual) { // he is checking us, but did not repeat yet
                                    break; // (or we would have caught him before). Abort repetition-checking loop.
@@ -6916,7 +6916,7 @@ Adjudicate(ChessProgramState *cps)
                                    ourPerpetual = PerpetualChase(k+1, forwardMostMove);
                                    if(ourPerpetual && !hisPerpetual) { // we are actively chasing him: forfeit
                                        result = WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins;
-                                       details = "Xboard adjudication: perpetual chasing";
+                                       details = _("Xboard adjudication: perpetual chasing");
                                    } else
                                    if(hisPerpetual && !ourPerpetual)   // he is chasing us, but did not repeat yet
                                        break; // Abort repetition-checking loop.
@@ -6965,7 +6965,7 @@ Adjudicate(ChessProgramState *cps)
                           SendMoveToProgram(forwardMostMove-1, engineOpponent); /* make sure opponent gets to see move */
                         }
                          ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
-                         GameEnds( GameIsDrawn, "Xboard adjudication: 50-move rule", GE_XBOARD );
+                         GameEnds( GameIsDrawn, _("Xboard adjudication: 50-move rule"), GE_XBOARD );
                          return 1;
                 }
 
@@ -6999,7 +6999,7 @@ Adjudicate(ChessProgramState *cps)
                      SendMoveToProgram(forwardMostMove-1, engineOpponent); /* make sure opponent gets to see move */
                    }
                    ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
-                   GameEnds( GameIsDrawn, "Xboard adjudication: long game", GE_XBOARD );
+                   GameEnds( GameIsDrawn, _("Xboard adjudication: long game"), GE_XBOARD );
                    return 1;
                }
        return 0;
@@ -7270,7 +7270,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/
 
                 GameEnds( WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins, 
-                    "Xboard adjudication", 
+                    _("Xboard adjudication"), 
                     GE_XBOARD );
 
                 return;
index 24c5509..63b1080 100644 (file)
@@ -60,6 +60,7 @@ typedef VOIDSTAR ProcRef;
 #define NoProc ((ProcRef) 0)
 typedef VOIDSTAR InputSourceRef;
 
+char *T_ P((char *s));
 void ModeHighlight P((void));
 void SetICSMode P((void));
 void SetGNUMode P((void));
index c3212d4..c183bee 100644 (file)
@@ -188,6 +188,7 @@ typedef enum {
 extern WindowPlacement placementTab[NUM_WINDOWS];\r
 extern HWND hwndTab[NUM_WINDOWS]; // this remains pure front-end.\r
 \r
+void Translate( HWND hDlg, int id);
 VOID InitWindowPlacement( WindowPlacement * wp );\r
 VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp );\r
 VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, WindowPlacement * pwpChild );\r
index fc0dc12..856d76b 100644 (file)
@@ -15,7 +15,9 @@
 #include <stdio.h>\r
 #include <string.h>\r
 #include "common.h"\r
+#include "frontend.h"\r
 #include "backend.h"\r
+#include "winboard.h"\r
 #include "backendz.h"\r
 \r
 int layoutList[2*MAX_OPTIONS];\r