Merge commit 'v4.3.16'
[xboard.git] / xboard.c
index 54c457e..1f17046 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -192,11 +192,14 @@ extern char *getenv();
 #include "childio.h"\r
 #include "xgamelist.h"\r
 #include "xhistory.h"\r
-#include "xedittags.h"
-
-// must be moved to xengineoutput.h
-void EngineOutputProc P((Widget w, XEvent *event,
-                       String *prms, Cardinal *nprms));
+#include "xedittags.h"\r
+#include "gettext.h"\r
+\r
+// must be moved to xengineoutput.h\r
+\r
+void EngineOutputProc P((Widget w, XEvent *event,\r
+ String *prms, Cardinal *nprms));\r
+\r
 void EngineOutputPopDown();\r
 \r
 \r
@@ -207,6 +210,14 @@ void EngineOutputPopDown();
 #define usleep(t)   _sleep2(((t)+500)/1000)\r
 #endif\r
 \r
+#ifdef ENABLE_NLS\r
+# define  _(s) gettext (s)\r
+# define N_(s) gettext_noop (s)\r
+#else\r
+# define  _(s) (s)\r
+# define N_(s)  s\r
+#endif\r
+\r
 typedef struct {\r
     String string;\r
     XtActionProc proc;\r
@@ -459,13 +470,13 @@ char *layoutName;
 char *oldICSInteractionTitle;\r
 \r
 FileProc fileProc;\r
-char *fileOpenMode;
+char *fileOpenMode;\r
 char installDir[] = "."; // [HGM] UCI: needed for UCI; probably needs run-time initializtion\r
 \r
 Position commentX = -1, commentY = -1;\r
 Dimension commentW, commentH;\r
 \r
-int squareSize, smallLayout = 0, tinyLayout = 0,
+int squareSize, smallLayout = 0, tinyLayout = 0,\r
   marginW, marginH, // [HGM] for run-time resizing\r
   fromX = -1, fromY = -1, toX, toY, commentUp = False, analysisUp = False,\r
   ICSInputBoxUp = False, askQuestionUp = False,\r
@@ -524,149 +535,149 @@ static Pixmap xpmMask[BlackKing + 1];
 SizeDefaults sizeDefaults[] = SIZE_DEFAULTS;\r
 \r
 MenuItem fileMenu[] = {\r
-    {"New Game", ResetProc},\r
-    {"New Shuffle Game ...", ShuffleMenuProc},\r
-    {"New Variant ...", NewVariantProc},      // [HGM] variant: not functional yet\r
+    {N_("New Game"), ResetProc},\r
+    {N_("New Shuffle Game ..."), ShuffleMenuProc},\r
+    {N_("New Variant ..."), NewVariantProc},      // [HGM] variant: not functional yet\r
     {"----", NothingProc},\r
-    {"Load Game", LoadGameProc},\r
-    {"Load Next Game", LoadNextGameProc},\r
-    {"Load Previous Game", LoadPrevGameProc},\r
-    {"Reload Same Game", ReloadGameProc},\r
-    {"Save Game", SaveGameProc},\r
+    {N_("Load Game"), LoadGameProc},\r
+    {N_("Load Next Game"), LoadNextGameProc},\r
+    {N_("Load Previous Game"), LoadPrevGameProc},\r
+    {N_("Reload Same Game"), ReloadGameProc},\r
+    {N_("Save Game"), SaveGameProc},\r
     {"----", NothingProc},\r
-    {"Copy Game", CopyGameProc},\r
-    {"Paste Game", PasteGameProc},\r
+    {N_("Copy Game"), CopyGameProc},\r
+    {N_("Paste Game"), PasteGameProc},\r
     {"----", NothingProc},\r
-    {"Load Position", LoadPositionProc},\r
-    {"Load Next Position", LoadNextPositionProc},\r
-    {"Load Previous Position", LoadPrevPositionProc},\r
-    {"Reload Same Position", ReloadPositionProc},\r
-    {"Save Position", SavePositionProc},\r
+    {N_("Load Position"), LoadPositionProc},\r
+    {N_("Load Next Position"), LoadNextPositionProc},\r
+    {N_("Load Previous Position"), LoadPrevPositionProc},\r
+    {N_("Reload Same Position"), ReloadPositionProc},\r
+    {N_("Save Position"), SavePositionProc},\r
     {"----", NothingProc},\r
-    {"Copy Position", CopyPositionProc},\r
-    {"Paste Position", PastePositionProc},\r
+    {N_("Copy Position"), CopyPositionProc},\r
+    {N_("Paste Position"), PastePositionProc},\r
     {"----", NothingProc},\r
-    {"Mail Move", MailMoveProc},\r
-    {"Reload CMail Message", ReloadCmailMsgProc},\r
+    {N_("Mail Move"), MailMoveProc},\r
+    {N_("Reload CMail Message"), ReloadCmailMsgProc},\r
     {"----", NothingProc},\r
-    {"Exit", QuitProc},\r
+    {N_("Exit"), QuitProc},\r
     {NULL, NULL}\r
 };\r
 \r
 MenuItem modeMenu[] = {\r
-    {"Machine White", MachineWhiteProc},\r
-    {"Machine Black", MachineBlackProc},\r
-    {"Two Machines", TwoMachinesProc},\r
-    {"Analysis Mode", AnalyzeModeProc},\r
-    {"Analyze File", AnalyzeFileProc },\r
-    {"ICS Client", IcsClientProc},\r
-    {"Edit Game", EditGameProc},\r
-    {"Edit Position", EditPositionProc},\r
-    {"Training", TrainingProc},\r
+    {N_("Machine White"), MachineWhiteProc},\r
+    {N_("Machine Black"), MachineBlackProc},\r
+    {N_("Two Machines"), TwoMachinesProc},\r
+    {N_("Analysis Mode"), AnalyzeModeProc},\r
+    {N_("Analyze File"), AnalyzeFileProc },\r
+    {N_("ICS Client"), IcsClientProc},\r
+    {N_("Edit Game"), EditGameProc},\r
+    {N_("Edit Position"), EditPositionProc},\r
+    {N_("Training"), TrainingProc},\r
     {"----", NothingProc},\r
-    {"Show Engine Output", EngineOutputProc},\r
-    {"Show Evaluation Graph", NothingProc}, // [HGM] evalgr: not functional yet\r
-    {"Show Game List", ShowGameListProc},\r
+    {N_("Show Engine Output"), EngineOutputProc},\r
+    {N_("Show Evaluation Graph"), NothingProc}, // [HGM] evalgr: not functional yet\r
+    {N_("Show Game List"), ShowGameListProc},\r
     {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code\r
     {"----", NothingProc},\r
-    {"Edit Tags", EditTagsProc},\r
-    {"Edit Comment", EditCommentProc},\r
-    {"ICS Input Box", IcsInputBoxProc},\r
-    {"Pause", PauseProc},\r
+    {N_("Edit Tags"), EditTagsProc},\r
+    {N_("Edit Comment"), EditCommentProc},\r
+    {N_("ICS Input Box"), IcsInputBoxProc},\r
+    {N_("Pause"), PauseProc},\r
     {NULL, NULL}\r
 };\r
 \r
 MenuItem actionMenu[] = {\r
-    {"Accept", AcceptProc},\r
-    {"Decline", DeclineProc},\r
-    {"Rematch", RematchProc},\r
+    {N_("Accept"), AcceptProc},\r
+    {N_("Decline"), DeclineProc},\r
+    {N_("Rematch"), RematchProc},\r
     {"----", NothingProc},    \r
-    {"Call Flag", CallFlagProc},\r
-    {"Draw", DrawProc},\r
-    {"Adjourn", AdjournProc},\r
-    {"Abort", AbortProc},\r
-    {"Resign", ResignProc},\r
+    {N_("Call Flag"), CallFlagProc},\r
+    {N_("Draw"), DrawProc},\r
+    {N_("Adjourn"), AdjournProc},\r
+    {N_("Abort"), AbortProc},\r
+    {N_("Resign"), ResignProc},\r
     {"----", NothingProc},    \r
-    {"Stop Observing", StopObservingProc},\r
-    {"Stop Examining", StopExaminingProc},\r
+    {N_("Stop Observing"), StopObservingProc},\r
+    {N_("Stop Examining"), StopExaminingProc},\r
     {NULL, NULL}\r
 };\r
 \r
 MenuItem stepMenu[] = {\r
-    {"Backward", BackwardProc},\r
-    {"Forward", ForwardProc},\r
-    {"Back to Start", ToStartProc},\r
-    {"Forward to End", ToEndProc},\r
-    {"Revert", RevertProc},\r
-    {"Truncate Game", TruncateGameProc},\r
+    {N_("Backward"), BackwardProc},\r
+    {N_("Forward"), ForwardProc},\r
+    {N_("Back to Start"), ToStartProc},\r
+    {N_("Forward to End"), ToEndProc},\r
+    {N_("Revert"), RevertProc},\r
+    {N_("Truncate Game"), TruncateGameProc},\r
     {"----", NothingProc},    \r
-    {"Move Now", MoveNowProc},\r
-    {"Retract Move", RetractMoveProc},\r
+    {N_("Move Now"), MoveNowProc},\r
+    {N_("Retract Move"), RetractMoveProc},\r
     {NULL, NULL}\r
 };    \r
 \r
-MenuItem optionsMenu[] = {
-    {"Flip View", FlipViewProc},\r
+MenuItem optionsMenu[] = {\r
+    {N_("Flip View"), FlipViewProc},\r
     {"----", NothingProc},    \r
-    {"Adjudications ...", EngineMenuProc},    \r
-    {"General Settings ...", UciMenuProc},    \r
-    {"Engine #1 Settings ...", FirstSettingsProc},    \r
-    {"Engine #2 Settings ...", SecondSettingsProc},    \r
-    {"Time Control ...", TimeControlProc},    \r
+    {N_("Adjudications ..."), EngineMenuProc},    \r
+    {N_("General Settings ..."), UciMenuProc},    \r
+    {N_("Engine #1 Settings ..."), FirstSettingsProc},    \r
+    {N_("Engine #2 Settings ..."), SecondSettingsProc},    \r
+    {N_("Time Control ..."), TimeControlProc},    \r
     {"----", NothingProc},    \r
-    {"Always Queen", AlwaysQueenProc},\r
-    {"Animate Dragging", AnimateDraggingProc},\r
-    {"Animate Moving", AnimateMovingProc},\r
-    {"Auto Comment", AutocommProc},\r
-    {"Auto Flag", AutoflagProc},\r
-    {"Auto Flip View", AutoflipProc},\r
-    {"Auto Observe", AutobsProc},\r
-    {"Auto Raise Board", AutoraiseProc},\r
-    {"Auto Save", AutosaveProc},\r
-    {"Blindfold", BlindfoldProc},\r
-    {"Flash Moves", FlashMovesProc},\r
-    {"Get Move List", GetMoveListProc},\r
+    {N_("Always Queen"), AlwaysQueenProc},\r
+    {N_("Animate Dragging"), AnimateDraggingProc},\r
+    {N_("Animate Moving"), AnimateMovingProc},\r
+    {N_("Auto Comment"), AutocommProc},\r
+    {N_("Auto Flag"), AutoflagProc},\r
+    {N_("Auto Flip View"), AutoflipProc},\r
+    {N_("Auto Observe"), AutobsProc},\r
+    {N_("Auto Raise Board"), AutoraiseProc},\r
+    {N_("Auto Save"), AutosaveProc},\r
+    {N_("Blindfold"), BlindfoldProc},\r
+    {N_("Flash Moves"), FlashMovesProc},\r
+    {N_("Get Move List"), GetMoveListProc},\r
 #if HIGHDRAG\r
-    {"Highlight Dragging", HighlightDraggingProc},\r
+    {N_("Highlight Dragging"), HighlightDraggingProc},\r
 #endif\r
-    {"Highlight Last Move", HighlightLastMoveProc},\r
-    {"Move Sound", MoveSoundProc},\r
-    {"ICS Alarm", IcsAlarmProc},\r
-    {"Old Save Style", OldSaveStyleProc},\r
-    {"Periodic Updates", PeriodicUpdatesProc}, \r
-    {"Ponder Next Move", PonderNextMoveProc},\r
-    {"Popup Exit Message", PopupExitMessageProc},      \r
-    {"Popup Move Errors", PopupMoveErrorsProc},        \r
-    {"Premove", PremoveProc},\r
-    {"Quiet Play", QuietPlayProc},\r
-    {"Show Coords", ShowCoordsProc},\r
-    {"Hide Thinking", HideThinkingProc},\r
-    {"Test Legality", TestLegalityProc},\r
+    {N_("Highlight Last Move"), HighlightLastMoveProc},\r
+    {N_("Move Sound"), MoveSoundProc},\r
+    {N_("ICS Alarm"), IcsAlarmProc},\r
+    {N_("Old Save Style"), OldSaveStyleProc},\r
+    {N_("Periodic Updates"), PeriodicUpdatesProc},     \r
+    {N_("Ponder Next Move"), PonderNextMoveProc},\r
+    {N_("Popup Exit Message"), PopupExitMessageProc},  \r
+    {N_("Popup Move Errors"), PopupMoveErrorsProc},    \r
+    {N_("Premove"), PremoveProc},\r
+    {N_("Quiet Play"), QuietPlayProc},\r
+    {N_("Show Coords"), ShowCoordsProc},\r
+    {N_("Hide Thinking"), HideThinkingProc},\r
+    {N_("Test Legality"), TestLegalityProc},\r
     {NULL, NULL}\r
 };\r
 \r
 MenuItem helpMenu[] = {\r
-    {"Info XBoard", InfoProc},\r
-    {"Man XBoard", ManProc},\r
+    {N_("Info XBoard"), InfoProc},\r
+    {N_("Man XBoard"), ManProc},\r
     {"----", NothingProc},\r
-    {"Hint", HintProc},\r
-    {"Book", BookProc},\r
+    {N_("Hint"), HintProc},\r
+    {N_("Book"), BookProc},\r
     {"----", NothingProc},\r
-    {"About XBoard", AboutProc},\r
+    {N_("About XBoard"), AboutProc},\r
     {NULL, NULL}\r
 };\r
 \r
 Menu menuBar[] = {\r
-    {"File", fileMenu},\r
-    {"Mode", modeMenu},\r
-    {"Action", actionMenu},\r
-    {"Step", stepMenu},\r
-    {"Options", optionsMenu},\r
-    {"Help", helpMenu},\r
+    {N_("File"), fileMenu},\r
+    {N_("Mode"), modeMenu},\r
+    {N_("Action"), actionMenu},\r
+    {N_("Step"), stepMenu},\r
+    {N_("Options"), optionsMenu},\r
+    {N_("Help"), helpMenu},\r
     {NULL, NULL}\r
 };\r
 \r
-#define PAUSE_BUTTON "P"\r
+#define PAUSE_BUTTON N_("P")\r
 MenuItem buttonBar[] = {\r
     {"<<", ToStartProc},\r
     {"<", BackwardProc},\r
@@ -678,11 +689,11 @@ MenuItem buttonBar[] = {
 \r
 #define PIECE_MENU_SIZE 11\r
 String pieceMenuStrings[2][PIECE_MENU_SIZE] = {\r
-    { "White", "----", "Pawn", "Knight", "Bishop", "Rook", "Queen", "King",\r
-      "----", "Empty square", "Clear board" },\r
-    { "Black", "----", "Pawn", "Knight", "Bishop", "Rook", "Queen", "King",\r
-      "----", "Empty square", "Clear board" },\r
-  };\r
+    { N_("White"), "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"),\r
+      N_("Queen"), N_("King"), "----", N_("Empty square"), N_("Clear board") },\r
+    { N_("Black"), "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"),\r
+      N_("Queen"), N_("King"), "----", N_("Empty square"), N_("Clear board") },  \r
+};\r
 /* must be in same order as PieceMenuStrings! */\r
 ChessSquare pieceMenuTranslation[2][PIECE_MENU_SIZE] = {\r
     { WhitePlay, (ChessSquare) 0, WhitePawn, WhiteKnight, WhiteBishop,\r
@@ -695,7 +706,7 @@ ChessSquare pieceMenuTranslation[2][PIECE_MENU_SIZE] = {
 \r
 #define DROP_MENU_SIZE 6\r
 String dropMenuStrings[DROP_MENU_SIZE] = {\r
-    "----", "Pawn", "Knight", "Bishop", "Rook", "Queen"\r
+    "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"), N_("Queen")\r
   };\r
 /* must be in same order as PieceMenuStrings! */\r
 ChessSquare dropMenuTranslation[DROP_MENU_SIZE] = {\r
@@ -1173,6 +1184,9 @@ XtResource clientResources[] = {
     { "showButtonBar", "showButtonBar", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, showButtonBar),\r
        XtRImmediate, (XtPointer) True },\r
+    {"icsEngineAnalyze", "icsEngineAnalyze", XtRBoolean,        /* [DM] icsEngineAnalyze */\r
+        sizeof(Boolean), XtOffset(AppDataPtr, icsEngineAnalyze),\r
+        XtRImmediate, (XtPointer) False },\r
     { "firstScoreAbs", "firstScoreAbs", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, firstScoreIsAbsolute),\r
        XtRImmediate, (XtPointer) False },\r
@@ -1276,7 +1290,7 @@ XtResource clientResources[] = {
        XtRImmediate, (XtPointer) 0},\r
     { "suppressLoadMoves", "suppressLoadMoves", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, suppressLoadMoves),\r
-       XtRImmediate, (XtPointer) False},
+       XtRImmediate, (XtPointer) False},\r
     { "userName", "userName", XtRString,\r
        sizeof(String), XtOffset(AppDataPtr, userName),\r
        XtRImmediate, (XtPointer) 0},\r
@@ -1295,7 +1309,7 @@ XtResource clientResources[] = {
     { "niceEngines", "niceEngines", XtRInt,\r
        sizeof(int), XtOffset(AppDataPtr, niceEngines),\r
        XtRImmediate, (XtPointer) 0},\r
-
+\r
     // [HGM] Winboard_x UCI options\r
     { "firstIsUCI", "firstIsUCI", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, firstIsUCI),\r
@@ -1333,6 +1347,12 @@ XtResource clientResources[] = {
     { "delayAfterQuit", "delayAfterQuit", XtRInt,\r
        sizeof(int), XtOffset(AppDataPtr, delayAfterQuit),\r
        XtRImmediate, (XtPointer) 0},\r
+    { "nameOfDebugFile", "nameOfDebugFile", XtRString,\r
+       sizeof(String), XtOffset(AppDataPtr, nameOfDebugFile),\r
+       XtRImmediate, (XtPointer) "xboard.debug"},\r
+    { "noGUI", "noGUI", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, noGUI),\r
+       XtRImmediate, (XtPointer) 0},\r
 };\r
 \r
 XrmOptionDescRec shellOptions[] = {\r
@@ -1685,6 +1705,8 @@ XrmOptionDescRec shellOptions[] = {
     { "-niceEngines", "niceEngines", XrmoptionSepArg, NULL }, \r
     { "-delayBeforeQuit", "delayBeforeQuit", XrmoptionSepArg, NULL }, \r
     { "-delayAfterQuit", "delayAfterQuit", XrmoptionSepArg, NULL }, \r
+    { "-nameOfDebugFile", "nameOfDebugFile", XrmoptionSepArg, NULL }, \r
+    { "-noGUI", "noGUI", XrmoptionNoArg, "True" }, \r
 };\r
 \r
 \r
@@ -1917,7 +1939,7 @@ xpm_getavail(dirname, ext)
     dir = opendir(dirname);\r
     if (!dir)\r
       {\r
-         fprintf(stderr, "%s: Can't access XPM directory %s\n", \r
+         fprintf(stderr, _("%s: Can't access XPM directory %s\n"), \r
                  programName, dirname);\r
          exit(1);\r
       }\r
@@ -1940,7 +1962,7 @@ xpm_print_avail(fp, ext)
 {\r
     int i;\r
 \r
-    fprintf(fp, "Available `%s' sizes:\n", ext);\r
+    fprintf(fp, _("Available `%s' sizes:\n"), ext);\r
     for (i=1; i<MAXSQSIZE; ++i) {\r
        if (xpm_avail[i])\r
          printf("%d\n", i);\r
@@ -1976,7 +1998,7 @@ xpm_closest_to(dirname, size, ext)
     }\r
 \r
     if (!sm_index) {\r
-       fprintf(stderr, "Error: No `%s' files!\n", ext);\r
+       fprintf(stderr, _("Error: No `%s' files!\n"), ext);\r
        exit(1);\r
     }\r
 \r
@@ -1992,10 +2014,11 @@ xpm_closest_to(dirname, size, ext)
      int size;\r
      char *ext;\r
 {\r
-    fprintf(stderr, "Warning: No DIR structure found on this system --\n");\r
-    fprintf(stderr, "         Unable to autosize for XPM/XIM pieces.\n");\r
-    fprintf(stderr, "   Please report this error to frankm@hiwaay.net.\n");\r
-    fprintf(stderr, "   Include system type & operating system in message.\n");\r
+    fprintf(stderr, _("\\r
+Warning: No DIR structure found on this system --\n\\r
+         Unable to autosize for XPM/XIM pieces.\n\\r
+   Please report this error to frankm@hiwaay.net.\n\\r
+   Include system type & operating system in message.\n"));\r
     return size;\r
 }\r
 #endif /* HAVE_DIR_STRUCT */\r
@@ -2052,7 +2075,7 @@ parse_color(str, which)
     }\r
     if (!StrCaseCmp(buf, "default")) return -1;\r
 \r
-    fprintf(stderr, "%s: unrecognized color %s\n", programName, buf);\r
+    fprintf(stderr, _("%s: unrecognized color %s\n"), programName, buf);\r
     return -2;\r
 }\r
 \r
@@ -2062,7 +2085,7 @@ parse_cpair(cc, str)
      char *str;\r
 {\r
     if ((textColors[(int)cc].fg=parse_color(str, 0)) == -2) {\r
-       fprintf(stderr, "%s: can't parse foreground color in `%s'\n",\r
+       fprintf(stderr, _("%s: can't parse foreground color in `%s'\n"),\r
                programName, str);\r
        return -1;\r
     }\r
@@ -2099,34 +2122,35 @@ BoardToTop()
 \r
 #ifdef IDSIZES\r
   // eventually, all layout determining code should go into a subroutine, but until then IDSIZE remains undefined\r
-#else
+#else\r
 #define BoardSize int\r
 void InitDrawingSizes(BoardSize boardSize, int flags)\r
 {   // [HGM] resize is functional now, but for board format changes only (nr of ranks, files)\r
-    Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;
-    Arg args[16];
+    Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;\r
+    Arg args[16];\r
     XtGeometryResult gres;\r
-    int i;
-
+    int i;\r
+\r
     if(!formWidget) return;\r
-
+\r
     /*\r
      * Enable shell resizing.\r
      */\r
     shellArgs[0].value = (XtArgVal) &w;\r
     shellArgs[1].value = (XtArgVal) &h;\r
     XtGetValues(shellWidget, shellArgs, 2);\r
-
+\r
     shellArgs[4].value = 2*w; shellArgs[2].value = 10;\r
     shellArgs[5].value = 2*h; shellArgs[3].value = 10;\r
-    XtSetValues(shellWidget, &shellArgs[2], 4);
+    XtSetValues(shellWidget, &shellArgs[2], 4);\r
 \r
-    XtSetArg(args[0], XtNdefaultDistance, &sep);\r    XtGetValues(formWidget, args, 1);
+    XtSetArg(args[0], XtNdefaultDistance, &sep);\r
+    XtGetValues(formWidget, args, 1);\r
 \r
     boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);\r
-    boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
+    boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);\r
     CreateGrid();\r
-
+\r
     XtSetArg(args[0], XtNwidth, boardWidth);\r
     XtSetArg(args[1], XtNheight, boardHeight);\r
     XtSetValues(boardWidget, args, 2);\r
@@ -2137,7 +2161,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     XtSetValues(blackTimerWidget, args, 1);\r
 \r
     XawFormDoLayout(formWidget, False);\r
-
+\r
     if (appData.titleInWindow) {\r
        i = 0;\r
        XtSetArg(args[i], XtNborderWidth, &bor); i++;\r
@@ -2154,16 +2178,16 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
        gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);\r
        if (gres != XtGeometryYes && appData.debugMode) {\r
            fprintf(stderr,\r
-                   "%s: titleWidget geometry error %d %d %d %d %d\n",\r
+                   _("%s: titleWidget geometry error %d %d %d %d %d\n"),\r
                    programName, gres, w, h, wr, hr);\r
        }\r
     }\r
 \r
     XawFormDoLayout(formWidget, True);\r
-
+\r
     /*\r
      * Inhibit shell resizing.\r
-     */
+     */\r
     shellArgs[0].value = w = (XtArgVal) boardWidth + marginW;\r
     shellArgs[1].value = h = (XtArgVal) boardHeight + marginH;\r
     shellArgs[4].value = shellArgs[2].value = w;\r
@@ -2185,51 +2209,51 @@ main(argc, argv)
     XtGeometryResult gres;\r
     char *p;\r
     XrmDatabase xdb;\r
-    int forceMono = False;
+    int forceMono = False;\r
 #define INDIRECTION\r
-#ifdef INDIRECTION
-    // [HGM] before anything else, expand any indirection files amongst options
-    char *argvCopy[1000]; // 1000 seems enough
-    char newArgs[10000];  // holds actual characters
-    int k = 0;
-
-    srandom(time(0)); // [HGM] book: make random truly random
-
-    j = 0;
-    for(i=0; i<argc; i++) {
-       if(j >= 1000-2) { printf("too many arguments\n"); exit(-1); }
-//fprintf(stderr, "arg %s\n", argv[i]);
-       if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {
-           char c;
-           FILE *f = fopen(argv[i]+1, "rb");
-           if(f == NULL) { fprintf(stderr, "ignore %s\n", argv[i]); continue; } // do not expand non-existing
-           argvCopy[j++] = newArgs + k; // get ready for first argument from file
-           while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list
-               if(c == '\n') {
-                   if(j >= 1000-2) { printf("too many arguments\n"); exit(-1); }
-                   newArgs[k++] = 0;  // terminate current arg
-                   if(k >= 10000-1) { printf("too long arguments\n"); exit(-1); }
-                   argvCopy[j++] = newArgs + k; // get ready for next
-               } else {
-                   if(k >= 10000-1) { printf("too long arguments\n"); exit(-1); }
-                   newArgs[k++] = c;
-               }
-           }
-           newArgs[k] = 0;
-           j--;
-           fclose(f);
-       }
-    }
-    argvCopy[j] = NULL;
-    argv = argvCopy;
-    argc = j;
-#if 0
-    if(appData.debugMode,1) { // OK, appData is not initialized here yet...
-       for(i=0; i<argc; i++) fprintf(stderr, "argv[%2d] = '%s'\n", i, argv[i]);
-    }
-#endif
-#endif
-
+#ifdef INDIRECTION\r
+    // [HGM] before anything else, expand any indirection files amongst options\r
+    char *argvCopy[1000]; // 1000 seems enough\r
+    char newArgs[10000];  // holds actual characters\r
+    int k = 0;\r
+\r
+    srandom(time(0)); // [HGM] book: make random truly random\r
+\r
+    j = 0;\r
+    for(i=0; i<argc; i++) {\r
+       if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }\r
+//fprintf(stderr, "arg %s\n", argv[i]);\r
+       if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {\r
+           char c;\r
+           FILE *f = fopen(argv[i]+1, "rb");\r
+           if(f == NULL) { fprintf(stderr, _("ignore %s\n"), argv[i]); continue; } // do not expand non-existing\r
+           argvCopy[j++] = newArgs + k; // get ready for first argument from file\r
+           while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list\r
+               if(c == '\n') {\r
+                   if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }\r
+                   newArgs[k++] = 0;  // terminate current arg\r
+                   if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }\r
+                   argvCopy[j++] = newArgs + k; // get ready for next\r
+               } else {\r
+                   if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }\r
+                   newArgs[k++] = c;\r
+               }\r
+           }\r
+           newArgs[k] = 0;\r
+           j--;\r
+           fclose(f);\r
+       }\r
+    }\r
+    argvCopy[j] = NULL;\r
+    argv = argvCopy;\r
+    argc = j;\r
+#if 0\r
+    if(appData.debugMode,1) { // OK, appData is not initialized here yet...\r
+       for(i=0; i<argc; i++) fprintf(stderr, "argv[%2d] = '%s'\n", i, argv[i]);\r
+    }\r
+#endif\r
+#endif\r
+\r
 \r
     setbuf(stdout, NULL);\r
     setbuf(stderr, NULL);\r
@@ -2241,12 +2265,19 @@ main(argc, argv)
     else\r
       programName++;\r
 \r
+#ifdef ENABLE_NLS\r
+    XtSetLanguageProc(NULL, NULL, NULL);\r
+    bindtextdomain(PRODUCT, LOCALEDIR);\r
+    bind_textdomain_codeset(PRODUCT, "UTF-8");\r
+    textdomain(PRODUCT);\r
+#endif\r
+\r
     shellWidget =\r
       XtAppInitialize(&appContext, "XBoard", shellOptions,\r
                      XtNumber(shellOptions),\r
                      &argc, argv, xboardResources, NULL, 0);\r
     if (argc > 1) {\r
-       fprintf(stderr, "%s: unrecognized argument %s\n",\r
+       fprintf(stderr, _("%s: unrecognized argument %s\n"),\r
                programName, argv[1]);\r
        exit(2);\r
     }\r
@@ -2255,7 +2286,7 @@ main(argc, argv)
        chessDir = ".";\r
     } else {\r
        if (chdir(chessDir) != 0) {\r
-           fprintf(stderr, "%s: can't cd to CHESSDIR: ", programName);\r
+           fprintf(stderr, _("%s: can't cd to CHESSDIR: "), programName);\r
            perror(chessDir);\r
            exit(1);\r
        }\r
@@ -2273,10 +2304,19 @@ main(argc, argv)
                              clientResources, XtNumber(clientResources),\r
                              NULL, 0);\r
 \r
+    if (appData.debugMode && appData.nameOfDebugFile && strcmp(appData.nameOfDebugFile, "stderr")) {\r
+       /* [DM] debug info to file [HGM] make the filename a command-line option, and allow it to remain stderr */\r
+        if ((debugFP = fopen(appData.nameOfDebugFile, "w")) == NULL)  {\r
+           printf(_("Failed to open file '%s'\n"), appData.nameOfDebugFile);\r
+           exit(errno);\r
+        }\r
+        setbuf(debugFP, NULL);\r
+    }\r
+    \r
     /* [HGM,HR] make sure board size is acceptable */\r
     if(appData.NrFiles > BOARD_SIZE ||\r
        appData.NrRanks > BOARD_SIZE   )\r
-        DisplayFatalError("Recompile with BOARD_SIZE > 12, to support this size", 0, 2);\r
+        DisplayFatalError(_("Recompile with BOARD_SIZE > 12, to support this size"), 0, 2);\r
 \r
 #if !HIGHDRAG\r
     /* This feature does not work; animation needs a rewrite */\r
@@ -2312,7 +2352,7 @@ main(argc, argv)
                   &lineGap, &clockFontPxlSize, &coordFontPxlSize,\r
                   &fontPxlSize, &smallLayout, &tinyLayout);\r
         if (i == 0) {\r
-           fprintf(stderr, "%s: bad boardSize syntax %s\n",\r
+           fprintf(stderr, _("%s: bad boardSize syntax %s\n"),\r
                    programName, appData.boardSize);\r
            exit(2);\r
        }\r
@@ -2348,7 +2388,7 @@ main(argc, argv)
            while (szd->name != NULL &&\r
                   StrCaseCmp(szd->name, appData.boardSize) != 0) szd++;\r
            if (szd->name == NULL) {\r
-               fprintf(stderr, "%s: unrecognized boardSize name %s\n",\r
+               fprintf(stderr, _("%s: unrecognized boardSize name %s\n"),\r
                        programName, appData.boardSize);\r
                exit(2);\r
            }\r
@@ -2366,17 +2406,18 @@ main(argc, argv)
     if (strlen(appData.pixmapDirectory) > 0) {\r
        p = ExpandPathName(appData.pixmapDirectory);\r
        if (!p) {\r
-           fprintf(stderr, "Error expanding path name \"%s\"\n",\r
+           fprintf(stderr, _("Error expanding path name \"%s\"\n"),\r
                   appData.pixmapDirectory);\r
            exit(1);\r
        }\r
        if (appData.debugMode) {\r
-           fprintf(stderr, "XBoard square size (hint): %d\n", squareSize);\r
-           fprintf(stderr, "%s fulldir:%s:\n", IMAGE_EXT, p);\r
+          fprintf(stderr, _("\\r
+XBoard square size (hint): %d\n\\r
+%s fulldir:%s:\n"), squareSize, IMAGE_EXT, p);\r
        }\r
        squareSize = xpm_closest_to(p, squareSize, IMAGE_EXT);\r
        if (appData.debugMode) {\r
-           fprintf(stderr, "Closest %s size: %d\n", IMAGE_EXT, squareSize);\r
+           fprintf(stderr, _("Closest %s size: %d\n"), IMAGE_EXT, squareSize);\r
        }\r
     }\r
                \r
@@ -2493,12 +2534,12 @@ main(argc, argv)
     }\r
 \r
     if (forceMono) {\r
-      fprintf(stderr, "%s: too few colors available; trying monochrome mode\n",\r
+      fprintf(stderr, _("%s: too few colors available; trying monochrome mode\n"),\r
              programName);\r
     }\r
 \r
     if (appData.monoMode && appData.debugMode) {\r
-       fprintf(stderr, "white pixel = 0x%lx, black pixel = 0x%lx\n",\r
+       fprintf(stderr, _("white pixel = 0x%lx, black pixel = 0x%lx\n"),\r
                (unsigned long) XWhitePixel(xDisplay, xScreen),\r
                (unsigned long) XBlackPixel(xDisplay, xScreen));\r
     }\r
@@ -2516,7 +2557,7 @@ main(argc, argv)
       {\r
          if (appData.colorize) {\r
              fprintf(stderr,\r
-                     "%s: can't parse color names; disabling colorization\n",\r
+                     _("%s: can't parse color names; disabling colorization\n"),\r
                      programName);\r
          }\r
          appData.colorize = FALSE;\r
@@ -2550,7 +2591,7 @@ main(argc, argv)
     j = 0;\r
     widgetList[j++] = menuBarWidget = CreateMenuBar(menuBar);\r
     XtSetArg(args[0], XtNtop,    XtChainTop);\r
-    XtSetArg(args[1], XtNbottom, XtChainTop);
+    XtSetArg(args[1], XtNbottom, XtChainTop);\r
     XtSetValues(menuBarWidget, args, 2);\r
 \r
     widgetList[j++] = whiteTimerWidget =\r
@@ -2558,7 +2599,7 @@ main(argc, argv)
                     formWidget, timerArgs, XtNumber(timerArgs));\r
     XtSetArg(args[0], XtNfont, clockFontStruct);\r
     XtSetArg(args[1], XtNtop,    XtChainTop);\r
-    XtSetArg(args[2], XtNbottom, XtChainTop);
+    XtSetArg(args[2], XtNbottom, XtChainTop);\r
     XtSetValues(whiteTimerWidget, args, 3);\r
     \r
     widgetList[j++] = blackTimerWidget =\r
@@ -2566,7 +2607,7 @@ main(argc, argv)
                     formWidget, timerArgs, XtNumber(timerArgs));\r
     XtSetArg(args[0], XtNfont, clockFontStruct);\r
     XtSetArg(args[1], XtNtop,    XtChainTop);\r
-    XtSetArg(args[2], XtNbottom, XtChainTop);
+    XtSetArg(args[2], XtNbottom, XtChainTop);\r
     XtSetValues(blackTimerWidget, args, 3);\r
     \r
     if (appData.titleInWindow) {\r
@@ -2574,24 +2615,24 @@ main(argc, argv)
          XtCreateWidget("title", labelWidgetClass, formWidget,\r
                         titleArgs, XtNumber(titleArgs));\r
        XtSetArg(args[0], XtNtop,    XtChainTop);\r
-       XtSetArg(args[1], XtNbottom, XtChainTop);
+       XtSetArg(args[1], XtNbottom, XtChainTop);\r
        XtSetValues(titleWidget, args, 2);\r
     }\r
 \r
     if (appData.showButtonBar) {\r
       widgetList[j++] = buttonBarWidget = CreateButtonBar(buttonBar);\r
       XtSetArg(args[0], XtNleft,  XtChainRight); // [HGM] glue to right window edge\r
-      XtSetArg(args[1], XtNright, XtChainRight); //       for good run-time sizing
+      XtSetArg(args[1], XtNright, XtChainRight); //       for good run-time sizing\r
       XtSetArg(args[2], XtNtop,    XtChainTop);\r
-      XtSetArg(args[3], XtNbottom, XtChainTop);
+      XtSetArg(args[3], XtNbottom, XtChainTop);\r
       XtSetValues(buttonBarWidget, args, 4);\r
     }\r
 \r
     widgetList[j++] = messageWidget =\r
       XtCreateWidget("message", labelWidgetClass, formWidget,\r
-                    messageArgs, XtNumber(messageArgs));
+                    messageArgs, XtNumber(messageArgs));\r
     XtSetArg(args[0], XtNtop,    XtChainTop);\r
-    XtSetArg(args[1], XtNbottom, XtChainTop);
+    XtSetArg(args[1], XtNbottom, XtChainTop);\r
     XtSetValues(messageWidget, args, 2);\r
 \r
     widgetList[j++] = boardWidget =\r
@@ -2689,9 +2730,9 @@ main(argc, argv)
     i = 0;\r
     XtSetArg(args[0], XtNfromVert, messageWidget);\r
     XtSetArg(args[1], XtNtop,    XtChainTop);\r
-    XtSetArg(args[2], XtNbottom, XtChainBottom);
+    XtSetArg(args[2], XtNbottom, XtChainBottom);\r
     XtSetArg(args[3], XtNleft,   XtChainLeft);\r
-    XtSetArg(args[4], XtNright,  XtChainRight);
+    XtSetArg(args[4], XtNright,  XtChainRight);\r
     XtSetValues(boardWidget, args, 5);\r
 \r
     XtRealizeWidget(shellWidget);\r
@@ -2702,7 +2743,7 @@ main(argc, argv)
      * The value "2" is probably larger than needed.\r
      */\r
     XawFormDoLayout(formWidget, False);\r
-
+\r
 #define WIDTH_FUDGE 2\r
     i = 0;\r
     XtSetArg(args[i], XtNborderWidth, &bor);  i++;\r
@@ -2719,7 +2760,7 @@ main(argc, argv)
 \r
     gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);\r
     if (gres != XtGeometryYes && appData.debugMode) {\r
-      fprintf(stderr, "%s: messageWidget geometry error %d %d %d %d %d\n",\r
+      fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),\r
              programName, gres, w, h, wr, hr);\r
     }\r
     \r
@@ -2729,12 +2770,12 @@ main(argc, argv)
     w--;\r
     gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);\r
     if (gres != XtGeometryYes && appData.debugMode) {\r
-      fprintf(stderr, "%s: messageWidget geometry error %d %d %d %d %d\n",\r
+      fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),\r
              programName, gres, w, h, wr, hr);\r
     }\r
     /* !! end hack */\r
     XtSetArg(args[0], XtNleft,  XtChainLeft);  // [HGM] glue ends for good run-time sizing\r
-    XtSetArg(args[1], XtNright, XtChainRight);
+    XtSetArg(args[1], XtNright, XtChainRight);\r
     XtSetValues(messageWidget, args, 2);\r
 \r
     if (appData.titleInWindow) {\r
@@ -2753,7 +2794,7 @@ main(argc, argv)
        gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);\r
        if (gres != XtGeometryYes && appData.debugMode) {\r
            fprintf(stderr,\r
-                   "%s: titleWidget geometry error %d %d %d %d %d\n",\r
+                   _("%s: titleWidget geometry error %d %d %d %d %d\n"),\r
                    programName, gres, w, h, wr, hr);\r
        }\r
     }\r
@@ -2917,7 +2958,7 @@ main(argc, argv)
     XtGetValues(shellWidget, shellArgs, 2);\r
     shellArgs[4].value = shellArgs[2].value = w;\r
     shellArgs[5].value = shellArgs[3].value = h;\r
-    XtSetValues(shellWidget, &shellArgs[2], 4);
+    XtSetValues(shellWidget, &shellArgs[2], 4);\r
     marginW =  w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board\r
     marginH =  h - boardHeight;\r
 \r
@@ -2976,6 +3017,7 @@ main(argc, argv)
        InitPosition(TRUE);\r
 \r
     XtAppMainLoop(appContext);\r
+    if (appData.debugMode) fclose(debugFP); // [DM] debug\r
     return 0;\r
 }\r
 \r
@@ -3229,6 +3271,11 @@ Enables userThinkingEnables[] = {
 void SetICSMode()\r
 {\r
   SetMenuEnables(icsEnables);\r
+\r
+#ifdef ZIPPY\r
+  if (appData.zippyPlay && !appData.noChessProgram)   /* [DM] icsEngineAnalyze */\r
+     XtSetSensitive(XtNameToWidget(menuBarWidget, "menuMode.Analysis Mode"), True);\r
+#endif\r
 }\r
 \r
 void\r
@@ -3310,12 +3357,40 @@ char *FindFont(pattern, targetPxlSize)
     char **fonts, *p, *best, *scalable, *scalableTail;\r
     int i, j, nfonts, minerr, err, pxlSize;\r
 \r
+#ifdef ENABLE_NLS\r
+    char **missing_list;\r
+    int missing_count;\r
+    char *def_string, *base_fnt_lst, strInt[3];\r
+    XFontSet fntSet;\r
+    XFontStruct **fnt_list;\r
+\r
+    base_fnt_lst = calloc(1, strlen(pattern) + 3);\r
+    sprintf(strInt, "%d", targetPxlSize);\r
+    p = strstr(pattern, "--");\r
+    strncpy(base_fnt_lst, pattern, p - pattern + 2);\r
+    strcat(base_fnt_lst, strInt);\r
+    strcat(base_fnt_lst, strchr(p + 2, '-'));\r
+\r
+    if ((fntSet = XCreateFontSet(xDisplay, \r
+                                 base_fnt_lst, \r
+                                 &missing_list, \r
+                                 &missing_count, \r
+                                 &def_string)) == NULL) {\r
+\r
+       fprintf(stderr, _("Unable to create font set.\n"));\r
+       exit (2);\r
+    }\r
+\r
+    nfonts = XFontsOfFontSet(fntSet, &fnt_list, &fonts);\r
+#else\r
     fonts = XListFonts(xDisplay, pattern, 999999, &nfonts);\r
     if (nfonts < 1) {\r
-       fprintf(stderr, "%s: no fonts match pattern %s\n",\r
+       fprintf(stderr, _("%s: no fonts match pattern %s\n"),\r
                programName, pattern);\r
        exit(2);\r
     }\r
+#endif\r
+\r
     best = fonts[0];\r
     scalable = NULL;\r
     minerr = 999999;\r
@@ -3353,10 +3428,16 @@ char *FindFont(pattern, targetPxlSize)
         strcpy(p, best);\r
     }\r
     if (appData.debugMode) {\r
-        fprintf(debugFP, "resolved %s at pixel size %d\n  to %s\n",\r
+        fprintf(debugFP, _("resolved %s at pixel size %d\n  to %s\n"),\r
                pattern, targetPxlSize, p);\r
     }\r
-    XFreeFontNames(fonts);\r
+#ifdef ENABLE_NLS\r
+    if (missing_count > 0)\r
+       XFreeStringList(missing_list);\r
+    XFreeFontSet(xDisplay, fntSet);\r
+#else\r
+     XFreeFontNames(fonts);\r
+#endif\r
     return p;\r
 }\r
 \r
@@ -3381,7 +3462,7 @@ void CreateGCs()
     coordGC = XtGetGC(shellWidget, value_mask, &gc_values);\r
     XSetFont(xDisplay, coordGC, coordFontID);\r
     \r
-    // [HGM] make font for holdings counts (white on black0
+    // [HGM] make font for holdings counts (white on black0\r
     gc_values.foreground = XWhitePixel(xDisplay, xScreen);\r
     gc_values.background = XBlackPixel(xDisplay, xScreen);\r
     countGC = XtGetGC(shellWidget, value_mask, &gc_values);\r
@@ -3477,7 +3558,7 @@ void loadXIM(xim, xmask, filename, dest, mask)
 \r
     fp = fopen(filename, "rb");\r
     if (!fp) {\r
-       fprintf(stderr, "%s: error loading XIM!\n", programName);\r
+       fprintf(stderr, _("%s: error loading XIM!\n"), programName);\r
        exit(1);\r
     }\r
          \r
@@ -3569,11 +3650,11 @@ void CreateXIMPieces()
     } else {\r
        useImages = 1;\r
        if (appData.monoMode) {\r
-         DisplayFatalError("XIM pieces cannot be used in monochrome mode",\r
+         DisplayFatalError(_("XIM pieces cannot be used in monochrome mode"),\r
                            0, 2);\r
          ExitEvent(2);\r
        }\r
-       fprintf(stderr, "\nLoading XIMs...\n");\r
+       fprintf(stderr, _("\nLoading XIMs...\n"));\r
        /* Load pieces */\r
        for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {\r
            fprintf(stderr, "%d", piece+1);\r
@@ -3587,7 +3668,7 @@ void CreateXIMPieces()
                  XGetImage(xDisplay, DefaultRootWindow(xDisplay),\r
                            0, 0, ss, ss, AllPlanes, XYPixmap);\r
                if (appData.debugMode)\r
-                 fprintf(stderr, "(File:%s:) ", buf);\r
+                 fprintf(stderr, _("(File:%s:) "), buf);\r
                loadXIM(ximPieceBitmap[kind][piece], \r
                        ximtemp, buf,\r
                        &(xpmPieceBitmap[kind][piece]),\r
@@ -3603,26 +3684,26 @@ void CreateXIMPieces()
            useImageSqs = 0;\r
        } else {\r
            useImageSqs = 1;\r
-           fprintf(stderr, "light square ");\r
+           fprintf(stderr, _("light square "));\r
            ximLightSquare= \r
              XGetImage(xDisplay, DefaultRootWindow(xDisplay),\r
                        0, 0, ss, ss, AllPlanes, XYPixmap);\r
            if (appData.debugMode)\r
-             fprintf(stderr, "(File:%s:) ", buf);\r
+             fprintf(stderr, _("(File:%s:) "), buf);\r
 \r
            loadXIM(ximLightSquare, NULL, buf, &xpmLightSquare, NULL);\r
-           fprintf(stderr, "dark square ");\r
+           fprintf(stderr, _("dark square "));\r
            sprintf(buf, "%s/dsq%u.xim",\r
                    ExpandPathName(appData.pixmapDirectory), ss);\r
            if (appData.debugMode)\r
-             fprintf(stderr, "(File:%s:) ", buf);\r
+             fprintf(stderr, _("(File:%s:) "), buf);\r
            ximDarkSquare= \r
              XGetImage(xDisplay, DefaultRootWindow(xDisplay),\r
                        0, 0, ss, ss, AllPlanes, XYPixmap);\r
            loadXIM(ximDarkSquare, NULL, buf, &xpmDarkSquare, NULL);\r
            xpmJailSquare = xpmLightSquare;\r
        }\r
-       fprintf(stderr, "Done.\n");\r
+       fprintf(stderr, _("Done.\n"));\r
     }\r
     XSynchronize(xDisplay, False); /* Work-around for xlib/xt buffering bug */\r
 }\r
@@ -3664,7 +3745,7 @@ void CreateXPMPieces()
     attr.numsymbols = 4;\r
 \r
     if (appData.monoMode) {\r
-      DisplayFatalError("XPM pieces cannot be used in monochrome mode",\r
+      DisplayFatalError(_("XPM pieces cannot be used in monochrome mode"),\r
                        0, 2);\r
       ExitEvent(2);\r
     }\r
@@ -3674,7 +3755,7 @@ void CreateXPMPieces()
        /* Load pieces */\r
        while (pieces->size != squareSize && pieces->size) pieces++;\r
        if (!pieces->size) {\r
-         fprintf(stderr, "No builtin XPM pieces of size %d\n", squareSize);\r
+         fprintf(stderr, _("No builtin XPM pieces of size %d\n"), squareSize);\r
          exit(1);\r
        }\r
        for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {\r
@@ -3684,7 +3765,7 @@ void CreateXPMPieces()
                                               pieces->xpm[piece][kind],\r
                                               &(xpmPieceBitmap[kind][piece]),\r
                                               NULL, &attr)) != 0) {\r
-                 fprintf(stderr, "Error %d loading XPM image \"%s\"\n",\r
+                 fprintf(stderr, _("Error %d loading XPM image \"%s\"\n"),\r
                          r, buf);\r
                  exit(1); \r
                }       \r
@@ -3695,7 +3776,7 @@ void CreateXPMPieces()
     } else {\r
        useImages = 1;\r
        \r
-       fprintf(stderr, "\nLoading XPMs...\n");\r
+       fprintf(stderr, _("\nLoading XPMs...\n"));\r
 \r
        /* Load pieces */\r
        for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {\r
@@ -3706,12 +3787,12 @@ void CreateXPMPieces()
                        ToLower(PieceToChar((ChessSquare)piece)),\r
                        xpmkind[kind], ss);\r
                if (appData.debugMode) {\r
-                   fprintf(stderr, "(File:%s:) ", buf);\r
+                   fprintf(stderr, _("(File:%s:) "), buf);\r
                }\r
                if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,\r
                                           &(xpmPieceBitmap[kind][piece]),\r
                                           NULL, &attr)) != 0) {\r
-                   fprintf(stderr, "Error %d loading XPM file \"%s\"\n",\r
+                   fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),\r
                            r, buf);\r
                    exit(1); \r
                }       \r
@@ -3720,34 +3801,34 @@ void CreateXPMPieces()
        /* Load light and dark squares */\r
        /* If the LSQ and DSQ pieces don't exist, we will \r
           draw them with solid squares. */\r
-       fprintf(stderr, "light square ");\r
+       fprintf(stderr, _("light square "));\r
        sprintf(buf, "%s/lsq%u.xpm", ExpandPathName(appData.pixmapDirectory), ss);\r
        if (access(buf, 0) != 0) {\r
            useImageSqs = 0;\r
        } else {\r
            useImageSqs = 1;\r
            if (appData.debugMode)\r
-             fprintf(stderr, "(File:%s:) ", buf);\r
+             fprintf(stderr, _("(File:%s:) "), buf);\r
 \r
            if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,\r
                                       &xpmLightSquare, NULL, &attr)) != 0) {\r
-               fprintf(stderr, "Error %d loading XPM file \"%s\"\n", r, buf);\r
+               fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"), r, buf);\r
                exit(1);\r
            }\r
-           fprintf(stderr, "dark square ");\r
+           fprintf(stderr, _("dark square "));\r
            sprintf(buf, "%s/dsq%u.xpm",\r
                    ExpandPathName(appData.pixmapDirectory), ss);\r
            if (appData.debugMode) {\r
-               fprintf(stderr, "(File:%s:) ", buf);\r
+               fprintf(stderr, _("(File:%s:) "), buf);\r
            }\r
            if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,\r
                                       &xpmDarkSquare, NULL, &attr)) != 0) {\r
-               fprintf(stderr, "Error %d loading XPM file \"%s\"\n", r, buf);\r
+               fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"), r, buf);\r
                exit(1);\r
            }\r
        }\r
        xpmJailSquare = xpmLightSquare;\r
-       fprintf(stderr, "Done.\n");\r
+       fprintf(stderr, _("Done.\n"));\r
     }\r
     XSynchronize(xDisplay, False); /* Work-around for xlib/xt\r
                                      buffering bug */  \r
@@ -3824,25 +3905,25 @@ void ReadBitmap(pm, name, bits, wreq, hreq)
        if (errcode != BitmapSuccess) {\r
            switch (errcode) {\r
              case BitmapOpenFailed:\r
-               sprintf(msg, "Can't open bitmap file %s", fullname);\r
+               sprintf(msg, _("Can't open bitmap file %s"), fullname);\r
                break;\r
              case BitmapFileInvalid:\r
-               sprintf(msg, "Invalid bitmap in file %s", fullname);\r
+               sprintf(msg, _("Invalid bitmap in file %s"), fullname);\r
                break;\r
              case BitmapNoMemory:\r
-               sprintf(msg, "Ran out of memory reading bitmap file %s",\r
+               sprintf(msg, _("Ran out of memory reading bitmap file %s"),\r
                        fullname);\r
                break;\r
              default:\r
-               sprintf(msg, "Unknown XReadBitmapFile error %d on file %s",\r
+               sprintf(msg, _("Unknown XReadBitmapFile error %d on file %s"),\r
                        errcode, fullname);\r
                break;\r
            }\r
-           fprintf(stderr, "%s: %s...using built-in\n",\r
+           fprintf(stderr, _("%s: %s...using built-in\n"),\r
                    programName, msg);\r
        } else if (w != wreq || h != hreq) {\r
            fprintf(stderr,\r
-                   "%s: Bitmap %s is %dx%d, not %dx%d...using built-in\n",\r
+                   _("%s: Bitmap %s is %dx%d, not %dx%d...using built-in\n"),\r
                    programName, fullname, w, h, wreq, hreq);\r
        } else {\r
            return;\r
@@ -3850,7 +3931,7 @@ void ReadBitmap(pm, name, bits, wreq, hreq)
     }\r
     if (bits == NULL) {\r
 #if 0\r
-       fprintf(stderr, "%s: No built-in bitmap for %s; giving up\n",\r
+       fprintf(stderr, _("%s: No built-in bitmap for %s; giving up\n"),\r
                programName, name);\r
        exit(1);\r
 #endif\r
@@ -3917,8 +3998,9 @@ void CreateMenuBarPopup(parent, name, mb)
            entry = XtCreateManagedWidget(mi->string, smeLineObjectClass,\r
                                          menu, args, j);\r
        } else {\r
+          XtSetArg(args[j], XtNlabel, XtNewString(_(mi->string)));\r
            entry = XtCreateManagedWidget(mi->string, smeBSBObjectClass,\r
-                                         menu, args, j);\r
+                                         menu, args, j+1);\r
            XtAddCallback(entry, XtNcallback,\r
                          (XtCallbackProc) MenuBarSelect,\r
                          (caddr_t) mi->proc);\r
@@ -3949,10 +4031,14 @@ Widget CreateMenuBar(mb)
        XtSetArg(args[j], XtNmenuName, XtNewString(menuName));  j++;\r
        if (tinyLayout) {\r
            char shortName[2];\r
-           shortName[0] = mb->name[0];\r
+            shortName[0] = _(mb->name)[0];\r
            shortName[1] = NULLCHAR;\r
            XtSetArg(args[j], XtNlabel, XtNewString(shortName)); j++;\r
        }\r
+      else {\r
+          XtSetArg(args[j], XtNlabel, XtNewString(_(mb->name))); j++;\r
+      }\r
+\r
        XtSetArg(args[j], XtNborderWidth, 0);                   j++;\r
        anchor = XtCreateManagedWidget(mb->name, menuButtonWidgetClass,\r
                                       menuBar, args, j);\r
@@ -3985,6 +4071,7 @@ Widget CreateButtonBar(mi)
            XtSetArg(args[j], XtNinternalWidth, 2); j++;\r
            XtSetArg(args[j], XtNborderWidth, 0); j++;\r
        }\r
+      XtSetArg(args[j], XtNlabel, XtNewString(_(mi->string))); j++;\r
        button = XtCreateManagedWidget(mi->string, commandWidgetClass,\r
                                       buttonBar, args, j);\r
        XtAddCallback(button, XtNcallback,\r
@@ -4015,8 +4102,9 @@ CreatePieceMenu(name, color)
            entry = XtCreateManagedWidget(item, smeLineObjectClass,\r
                                          menu, NULL, 0);\r
        } else {\r
+          XtSetArg(args[0], XtNlabel, XtNewString(_(item))); \r
            entry = XtCreateManagedWidget(item, smeBSBObjectClass,\r
-                                         menu, NULL, 0);\r
+                                menu, args, 1);\r
            selection = pieceMenuTranslation[color][i];\r
            XtAddCallback(entry, XtNcallback,\r
                          (XtCallbackProc) PieceMenuSelect,\r
@@ -4045,7 +4133,7 @@ CreatePieceMenus()
                         (unsigned)(ButtonPressMask|ButtonReleaseMask),\r
                         GrabModeAsync, GrabModeAsync);\r
 \r
-    XtSetArg(args[0], XtNlabel, "Drop");\r
+    XtSetArg(args[0], XtNlabel, _("Drop"));\r
     dropMenu = XtCreatePopupShell("menuD", simpleMenuWidgetClass,\r
                                  boardWidget, args, 1);\r
     for (i = 0; i < DROP_MENU_SIZE; i++) {\r
@@ -4055,8 +4143,9 @@ CreatePieceMenus()
            entry = XtCreateManagedWidget(item, smeLineObjectClass,\r
                                          dropMenu, NULL, 0);\r
        } else {\r
+          XtSetArg(args[0], XtNlabel, XtNewString(_(item))); \r
            entry = XtCreateManagedWidget(item, smeBSBObjectClass,\r
-                                         dropMenu, NULL, 0);\r
+                                dropMenu, args, 1);\r
            selection = dropMenuTranslation[i];\r
            XtAddCallback(entry, XtNcallback,\r
                          (XtCallbackProc) DropMenuSelect,\r
@@ -4502,17 +4591,17 @@ void DrawSquare(row, column, piece, do_flash)
     DrawFunc drawfunc;\r
     int flash_delay;\r
 \r
-    if(gameInfo.variant == VariantShogi) { // [HGM] shogi: in shogi Q is used for Lance
-       if(piece == WhiteQueen) piece = WhiteLance; else
-       if(piece == BlackQueen) piece = BlackLance;
-    }
-#ifdef GOTHIC
-    else if(gameInfo.variant == VariantGothic) { // [HGM] shogi: in Gothic Chancelor has alternative look
-       if(piece == WhiteMarshall) piece = WhiteSilver; else
-       if(piece == BlackMarshall) piece = BlackSilver;
-    }
-#endif
-
+    if(gameInfo.variant == VariantShogi) { // [HGM] shogi: in shogi Q is used for Lance\r
+       if(piece == WhiteQueen) piece = WhiteLance; else\r
+       if(piece == BlackQueen) piece = BlackLance;\r
+    }\r
+#ifdef GOTHIC\r
+    else if(gameInfo.variant == VariantGothic) { // [HGM] shogi: in Gothic Chancelor has alternative look\r
+       if(piece == WhiteMarshall) piece = WhiteSilver; else\r
+       if(piece == BlackMarshall) piece = BlackSilver;\r
+    }\r
+#endif\r
+\r
     /* Calculate delay in milliseconds (2-delays per complete flash) */\r
     flash_delay = 500 / appData.flashRate;\r
        \r
@@ -4532,9 +4621,9 @@ void DrawSquare(row, column, piece, do_flash)
                  column == BOARD_LEFT-1 ||  column == BOARD_RGHT\r
               || (column == BOARD_LEFT-2 && row < BOARD_HEIGHT-gameInfo.holdingsSize)\r
                  || (column == BOARD_RGHT+1 && row >= gameInfo.holdingsSize) ) {\r
-                       BlankSquare(x, y, 2, EmptySquare, xBoardWindow);
+                       BlankSquare(x, y, 2, EmptySquare, xBoardWindow);\r
 \r
-                       // [HGM] print piece counts next to holdings
+                       // [HGM] print piece counts next to holdings\r
                        string[1] = NULLCHAR;\r
                        if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {\r
                            string[0] = '0' + piece;\r
@@ -4584,7 +4673,7 @@ void DrawSquare(row, column, piece, do_flash)
        }\r
        \r
     string[1] = NULLCHAR;\r
-    if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
+    if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)\r
                && column >= BOARD_LEFT && column < BOARD_RGHT) {\r
        string[0] = 'a' + column - BOARD_LEFT;\r
        XTextExtents(coordFontStruct, string, 1, &direction, \r
@@ -5055,7 +5144,7 @@ Widget CommentCreate(name, text, mutable, callback, lines)
        XtSetArg(args[j], XtNleft, XtChainLeft); j++;\r
        XtSetArg(args[j], XtNright, XtChainLeft); j++;\r
        b_ok =\r
-         XtCreateManagedWidget("ok", commandWidgetClass, form, args, j);\r
+         XtCreateManagedWidget(_("ok"), commandWidgetClass, form, args, j);\r
        XtAddCallback(b_ok, XtNcallback, callback, (XtPointer) 0);\r
 \r
        j = 0;\r
@@ -5066,7 +5155,7 @@ Widget CommentCreate(name, text, mutable, callback, lines)
        XtSetArg(args[j], XtNleft, XtChainLeft); j++;\r
        XtSetArg(args[j], XtNright, XtChainLeft); j++;\r
        b_cancel =\r
-         XtCreateManagedWidget("cancel", commandWidgetClass, form, args, j);\r
+         XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j);\r
        XtAddCallback(b_cancel, XtNcallback, callback, (XtPointer) 0);\r
 \r
        j = 0;\r
@@ -5077,7 +5166,7 @@ Widget CommentCreate(name, text, mutable, callback, lines)
        XtSetArg(args[j], XtNleft, XtChainLeft); j++;\r
        XtSetArg(args[j], XtNright, XtChainLeft); j++;\r
        b_clear =\r
-         XtCreateManagedWidget("clear", commandWidgetClass, form, args, j);\r
+         XtCreateManagedWidget(_("clear"), commandWidgetClass, form, args, j);\r
        XtAddCallback(b_clear, XtNcallback, callback, (XtPointer) 0);\r
     } else {\r
        j = 0;\r
@@ -5087,7 +5176,7 @@ Widget CommentCreate(name, text, mutable, callback, lines)
        XtSetArg(args[j], XtNleft, XtChainLeft); j++;\r
        XtSetArg(args[j], XtNright, XtChainLeft); j++;\r
        b_close =\r
-         XtCreateManagedWidget("close", commandWidgetClass, form, args, j);\r
+         XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j);\r
        XtAddCallback(b_close, XtNcallback, callback, (XtPointer) 0);\r
 \r
        j = 0;\r
@@ -5098,7 +5187,7 @@ Widget CommentCreate(name, text, mutable, callback, lines)
        XtSetArg(args[j], XtNleft, XtChainLeft); j++;\r
        XtSetArg(args[j], XtNright, XtChainLeft); j++;\r
        b_edit =\r
-         XtCreateManagedWidget("edit", commandWidgetClass, form, args, j);\r
+         XtCreateManagedWidget(_("edit"), commandWidgetClass, form, args, j);\r
        XtAddCallback(b_edit, XtNcallback, callback, (XtPointer) 0);\r
     }\r
 \r
@@ -5299,16 +5388,16 @@ void EditCommentCallback(w, client_data, call_data)
     XtSetArg(args[j], XtNlabel, &name);  j++;\r
     XtGetValues(w, args, j);\r
 \r
-    if (strcmp(name, "ok") == 0) {\r
+    if (strcmp(name, _("ok")) == 0) {\r
        edit = XtNameToWidget(editShell, "*form.text");\r
        j = 0;\r
        XtSetArg(args[j], XtNstring, &val); j++;\r
        XtGetValues(edit, args, j);\r
        ReplaceComment(savedIndex, val);\r
        EditCommentPopDown();\r
-    } else if (strcmp(name, "cancel") == 0) {\r
+    } else if (strcmp(name, _("cancel")) == 0) {\r
        EditCommentPopDown();\r
-    } else if (strcmp(name, "clear") == 0) {\r
+    } else if (strcmp(name, _("clear")) == 0) {\r
        edit = XtNameToWidget(editShell, "*form.text");\r
        XtCallActionProc(edit, "select-all", NULL, NULL, 0);\r
        XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);\r
@@ -5340,7 +5429,7 @@ void ICSInputBoxPopUp()
     Widget edit;\r
     Arg args[16];\r
     int j;\r
-    char *title = "ICS Input";\r
+    char *title = _("ICS Input");\r
     XtTranslations tr;\r
        \r
     if (ICSInputShell == NULL) {\r
@@ -5475,9 +5564,9 @@ void CommentCallback(w, client_data, call_data)
     XtSetArg(args[j], XtNlabel, &name);  j++;\r
     XtGetValues(w, args, j);\r
 \r
-    if (strcmp(name, "close") == 0) {\r
+    if (strcmp(name, _("close")) == 0) {\r
        CommentPopDown();\r
-    } else if (strcmp(name, "edit") == 0) {\r
+    } else if (strcmp(name, _("edit")) == 0) {\r
        CommentPopDown();\r
        EditCommentEvent();\r
     }\r
@@ -5507,6 +5596,7 @@ void AnalysisPopDown()
     XtPopdown(analysisShell);\r
     XSync(xDisplay, False);\r
     analysisUp = False;\r
+    if (appData.icsEngineAnalyze) ExitAnalyzeMode();    /* [DM] icsEngineAnalyze */\r
 }\r
 \r
 \r
@@ -5529,6 +5619,7 @@ void FileNamePopUp(label, def, proc, openMode)
     i = 0;\r
     XtSetArg(args[i], XtNresizable, True); i++;\r
     XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;\r
+    XtSetArg(args[i], XtNtitle, XtNewString(_("File name prompt"))); i++;\r
     fileNameShell = popup =\r
       XtCreatePopupShell("File name prompt", transientShellWidgetClass,\r
                         shellWidget, args, i);\r
@@ -5544,8 +5635,8 @@ void FileNamePopUp(label, def, proc, openMode)
     dialog = XtCreateManagedWidget("fileName", dialogWidgetClass,\r
                                   layout, args, i);\r
     \r
-    XawDialogAddButton(dialog, "ok", FileNameCallback, (XtPointer) dialog);\r
-    XawDialogAddButton(dialog, "cancel", FileNameCallback,\r
+    XawDialogAddButton(dialog, _("ok"), FileNameCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, _("cancel"), FileNameCallback,\r
                       (XtPointer) dialog);\r
     \r
     XtRealizeWidget(popup);\r
@@ -5584,7 +5675,7 @@ void FileNameCallback(w, client_data, call_data)
     XtSetArg(args[0], XtNlabel, &name);\r
     XtGetValues(w, args, 1);\r
     \r
-    if (strcmp(name, "cancel") == 0) {\r
+    if (strcmp(name, _("cancel")) == 0) {\r
         FileNamePopDown();\r
         return;\r
     }\r
@@ -5621,12 +5712,12 @@ void FileNameAction(w, event, prms, nprms)
        }\r
        fullname = ExpandPathName(buf);\r
        if (!fullname) {\r
-           ErrorPopUp("Error", "Can't open file", FALSE);\r
+           ErrorPopUp(_("Error"), _("Can't open file"), FALSE);\r
        }\r
        else {\r
            f = fopen(fullname, fileOpenMode);\r
            if (f == NULL) {\r
-               DisplayError("Failed to open file", errno);\r
+               DisplayError(_("Failed to open file"), errno);\r
            } else {\r
                (void) (*fileProc)(f, index, buf);\r
            }\r
@@ -5655,6 +5746,7 @@ void PromotionPopUp()
     \r
     j = 0;\r
     XtSetArg(args[j], XtNresizable, True); j++;\r
+    XtSetArg(args[j], XtNtitle, XtNewString(_("Promotion"))); j++;\r
     promotionShell =\r
       XtCreatePopupShell("Promotion", transientShellWidgetClass,\r
                         shellWidget, args, j);\r
@@ -5663,25 +5755,25 @@ void PromotionPopUp()
                            layoutArgs, XtNumber(layoutArgs));\r
     \r
     j = 0;\r
-    XtSetArg(args[j], XtNlabel, "Promote pawn to what?"); j++;\r
+    XtSetArg(args[j], XtNlabel, _("Promote pawn to what?")); j++;\r
     XtSetArg(args[j], XtNborderWidth, 0); j++;\r
     dialog = XtCreateManagedWidget("promotion", dialogWidgetClass,\r
                                   layout, args, j);\r
     \r
-    XawDialogAddButton(dialog, "Queen", PromotionCallback, \r
+    XawDialogAddButton(dialog, _("Queen"), PromotionCallback, \r
                       (XtPointer) dialog);\r
-    XawDialogAddButton(dialog, "Rook", PromotionCallback, \r
+    XawDialogAddButton(dialog, _("Rook"), PromotionCallback, \r
                       (XtPointer) dialog);\r
-    XawDialogAddButton(dialog, "Bishop", PromotionCallback, \r
+    XawDialogAddButton(dialog, _("Bishop"), PromotionCallback, \r
                       (XtPointer) dialog);\r
-    XawDialogAddButton(dialog, "Knight", PromotionCallback, \r
+    XawDialogAddButton(dialog, _("Knight"), PromotionCallback, \r
                       (XtPointer) dialog);\r
     if (!appData.testLegality || gameInfo.variant == VariantSuicide ||\r
         gameInfo.variant == VariantGiveaway) {\r
-      XawDialogAddButton(dialog, "King", PromotionCallback, \r
+      XawDialogAddButton(dialog, _("King"), PromotionCallback, \r
                         (XtPointer) dialog);\r
     }\r
-    XawDialogAddButton(dialog, "cancel", PromotionCallback, \r
+    XawDialogAddButton(dialog, _("cancel"), PromotionCallback, \r
                       (XtPointer) dialog);\r
     \r
     XtRealizeWidget(promotionShell);\r
@@ -5729,11 +5821,11 @@ void PromotionCallback(w, client_data, call_data)
     \r
     if (fromX == -1) return;\r
     \r
-    if (strcmp(name, "cancel") == 0) {\r
+    if (strcmp(name, _("cancel")) == 0) {\r
        fromX = fromY = -1;\r
        ClearHighlights();\r
        return;\r
-    } else if (strcmp(name, "Knight") == 0) {\r
+    } else if (strcmp(name, _("Knight")) == 0) {\r
        promoChar = 'n';\r
     } else {\r
        promoChar = ToLower(name[0]);\r
@@ -5796,7 +5888,7 @@ void ErrorPopUp(title, label, modal)
     dialog = XtCreateManagedWidget("dialog", dialogWidgetClass,\r
                                   layout, args, i);\r
     \r
-    XawDialogAddButton(dialog, "ok", ErrorCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, _("ok"), ErrorCallback, (XtPointer) dialog);\r
     \r
     XtRealizeWidget(errorShell);\r
     CatchDeleteWindow(errorShell, "ErrorPopDown");\r
@@ -5981,7 +6073,7 @@ int LoadGamePopUp(f, gameNumber, title)
     if (gameNumber == 0) {\r
        int error = GameListBuild(f);\r
        if (error) {\r
-           DisplayError("Cannot build game list", error);\r
+           DisplayError(_("Cannot build game list"), error);\r
        } else if (!ListEmpty(&gameList) &&\r
                   ((ListGame *) gameList.tailPred)->number > 1) {\r
            GameListPopUp(f, title);\r
@@ -6002,7 +6094,7 @@ void LoadGameProc(w, event, prms, nprms)
     if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
        Reset(FALSE, TRUE);\r
     }\r
-    FileNamePopUp("Load game file name?", "", LoadGamePopUp, "rb");\r
+    FileNamePopUp(_("Load game file name?"), "", LoadGamePopUp, "rb");\r
 }\r
 \r
 void LoadNextGameProc(w, event, prms, nprms)\r
@@ -6068,7 +6160,7 @@ void LoadPositionProc(w, event, prms, nprms)
     if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
        Reset(FALSE, TRUE);\r
     }\r
-    FileNamePopUp("Load position file name?", "", LoadPosition, "rb");\r
+    FileNamePopUp(_("Load position file name?"), "", LoadPosition, "rb");\r
 }\r
 \r
 void SaveGameProc(w, event, prms, nprms)\r
@@ -6077,7 +6169,7 @@ void SaveGameProc(w, event, prms, nprms)
      String *prms;\r
      Cardinal *nprms;\r
 {\r
-    FileNamePopUp("Save game file name?",\r
+    FileNamePopUp(_("Save game file name?"),\r
                  DefaultFileName(appData.oldSaveStyle ? "game" : "pgn"),\r
                  SaveGame, "a");\r
 }\r
@@ -6088,7 +6180,7 @@ void SavePositionProc(w, event, prms, nprms)
      String *prms;\r
      Cardinal *nprms;\r
 {\r
-    FileNamePopUp("Save position file name?",\r
+    FileNamePopUp(_("Save position file name?"),\r
                  DefaultFileName(appData.oldSaveStyle ? "pos" : "fen"),\r
                  SavePosition, "a");\r
 }\r
@@ -6260,7 +6352,7 @@ PasteGameCB(Widget w, XtPointer client_data, Atom *selection,
   }\r
   f = fopen(gamePasteFilename, "w");\r
   if (f == NULL) {\r
-    DisplayError("Can't open temp file", errno);\r
+    DisplayError(_("Can't open temp file"), errno);\r
     return;\r
   }\r
   fwrite(value, 1, *len, f);\r
@@ -6339,12 +6431,37 @@ void AnalyzeModeProc(w, event, prms, nprms)
      String *prms;\r
      Cardinal *nprms;\r
 {\r
+    char buf[MSG_SIZ];\r
+    \r
     if (!first.analysisSupport) {\r
-      char buf[MSG_SIZ];\r
-      sprintf(buf, "%s does not support analysis", first.tidy);\r
+      sprintf(buf, _("%s does not support analysis"), first.tidy);\r
       DisplayError(buf, 0);\r
       return;\r
     }\r
+    /* [DM] icsEngineAnalyze [HGM] This is horrible code; reverse the gameMode and isEngineAnalyze tests! */\r
+    if (appData.icsActive) {\r
+        if (gameMode != IcsObserving) {\r
+            sprintf(buf,_("You are not observing a game"));\r
+            DisplayError(buf, 0);\r
+            /* secure check */\r
+            if (appData.icsEngineAnalyze) {\r
+                if (appData.debugMode)\r
+                    fprintf(debugFP, _("Found unexpected active ICS engine analyze \n"));\r
+                ExitAnalyzeMode();\r
+                ModeHighlight();\r
+            }\r
+            return;\r
+        }\r
+        /* if enable, use want disable icsEngineAnalyze */\r
+        if (appData.icsEngineAnalyze) {\r
+                ExitAnalyzeMode();\r
+                ModeHighlight();\r
+                return;\r
+        }\r
+        appData.icsEngineAnalyze = TRUE;\r
+        if (appData.debugMode)\r
+            fprintf(debugFP, _("ICS engine analyze starting... \n"));\r
+    }   \r
     if (!appData.showThinking)\r
       ShowThinkingProc(w,event,prms,nprms);\r
 \r
@@ -6359,7 +6476,7 @@ void AnalyzeFileProc(w, event, prms, nprms)
 {\r
     if (!first.analysisSupport) {\r
       char buf[MSG_SIZ];\r
-      sprintf(buf, "%s does not support analysis", first.tidy);\r
+      sprintf(buf, _("%s does not support analysis"), first.tidy);\r
       DisplayError(buf, 0);\r
       return;\r
     }\r
@@ -6369,7 +6486,7 @@ void AnalyzeFileProc(w, event, prms, nprms)
       ShowThinkingProc(w,event,prms,nprms);\r
 \r
     AnalyzeFileEvent();\r
-    FileNamePopUp("File to analyze", "", LoadGamePopUp, "rb");\r
+    FileNamePopUp(_("File to analyze"), "", LoadGamePopUp, "rb");\r
     AnalysisPeriodicEvent(1);\r
 }\r
 \r
@@ -7127,9 +7244,9 @@ void ShowThinkingProc(w, event, prms, nprms)
 {\r
     Arg args[16];\r
 \r
-    appData.showThinking = !appData.showThinking; // [HGM] thinking: tken out of ShowThinkingEvent
+    appData.showThinking = !appData.showThinking; // [HGM] thinking: tken out of ShowThinkingEvent\r
     ShowThinkingEvent();\r
-#if 0
+#if 0\r
     // [HGM] thinking: currently no suc menu item; replaced by Hide Thinking (From Human)\r
     if (appData.showThinking) {\r
        XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);\r
@@ -7137,7 +7254,7 @@ void ShowThinkingProc(w, event, prms, nprms)
        XtSetArg(args[0], XtNleftBitmap, None);\r
     }\r
     XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Thinking"),\r
-               args, 1);
+               args, 1);\r
 #endif\r
 }\r
 \r
@@ -7149,7 +7266,7 @@ void HideThinkingProc(w, event, prms, nprms)
 {\r
     Arg args[16];\r
 \r
-    appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: tken out of ShowThinkingEvent
+    appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: tken out of ShowThinkingEvent\r
     ShowThinkingEvent();\r
 \r
     if (appData.hideThinkingFromHuman) {\r
@@ -7222,12 +7339,12 @@ void AboutProc(w, event, prms, nprms)
     sprintf(buf, "%s%s\n\n%s\n%s\n%s\n%s\n\n%s%s\n%s",\r
            programVersion, zippy,\r
            "Copyright 1991 Digital Equipment Corporation",\r
-           "Enhancements Copyright 1992-2001 Free Software Foundation",
+           "Enhancements Copyright 1992-2001 Free Software Foundation",\r
            "Enhancements Copyright 2005 Alessandro Scotti",\r
            "Enhancements Copyright 2007-2008 H.G.Muller",\r
            PRODUCT, " is free software and carries NO WARRANTY;",\r
            "see the file COPYING for more information.");\r
-    ErrorPopUp("About XBoard", buf, FALSE);\r
+    ErrorPopUp(_("About XBoard"), buf, FALSE);\r
 }\r
 \r
 void DebugProc(w, event, prms, nprms)\r
@@ -7313,17 +7430,17 @@ void DisplayTitle(text)
     } else if (appData.cmailGameName[0] != NULLCHAR) {\r
        sprintf(icon, "%s", "CMail");\r
        sprintf(title, "%s: %s", programName, "CMail");\r
-#ifdef GOTHIC
-    // [HGM] license: This stuff should really be done in back-end, but WinBoard already had a pop-up for it
+#ifdef GOTHIC\r
+    // [HGM] license: This stuff should really be done in back-end, but WinBoard already had a pop-up for it\r
     } else if (gameInfo.variant == VariantGothic) {\r
        strcpy(icon, programName);\r
        strcpy(title, GOTHIC);\r
-#endif
-#ifdef FALCON
+#endif\r
+#ifdef FALCON\r
     } else if (gameInfo.variant == VariantFalcon) {\r
        strcpy(icon, programName);\r
        strcpy(title, FALCON);\r
-#endif
+#endif\r
     } else if (appData.noChessProgram) {\r
        strcpy(icon, programName);\r
        strcpy(title, programName);\r
@@ -7356,7 +7473,7 @@ void DisplayError(message, error)
        sprintf(buf, "%s: %s", message, strerror(error));\r
        message = buf;\r
     }  \r
-    ErrorPopUp("Error", message, FALSE);\r
+    ErrorPopUp(_("Error"), message, FALSE);\r
 }\r
 \r
 \r
@@ -7370,7 +7487,7 @@ void DisplayMoveError(message)
        fprintf(stderr, "%s: %s\n", programName, message);\r
     }\r
     if (appData.popupMoveErrors) {\r
-       ErrorPopUp("Error", message, FALSE);\r
+       ErrorPopUp(_("Error"), message, FALSE);\r
     } else {\r
        DisplayMessage(message, "");\r
     }\r
@@ -7393,7 +7510,7 @@ void DisplayFatalError(message, error, status)
        message = buf;\r
     }\r
     if (appData.popupExitMessage && boardWidget && XtIsRealized(boardWidget)) {\r
-      ErrorPopUp(status ? "Fatal Error" : "Exiting", message, TRUE);\r
+      ErrorPopUp(status ? _("Fatal Error") : _("Exiting"), message, TRUE);\r
     } else {\r
       ExitEvent(status);\r
     }\r
@@ -7403,14 +7520,14 @@ void DisplayInformation(message)
      String message;\r
 {\r
     ErrorPopDown();\r
-    ErrorPopUp("Information", message, TRUE);\r
+    ErrorPopUp(_("Information"), message, TRUE);\r
 }\r
 \r
 void DisplayNote(message)\r
      String message;\r
 {\r
     ErrorPopDown();\r
-    ErrorPopUp("Note", message, FALSE);\r
+    ErrorPopUp(_("Note"), message, FALSE);\r
 }\r
 \r
 static int\r
@@ -7460,7 +7577,7 @@ void AskQuestionProc(w, event, prms, nprms)
      Cardinal *nprms;\r
 {\r
     if (*nprms != 4) {\r
-       fprintf(stderr, "AskQuestionProc needed 4 parameters, got %d\n",\r
+       fprintf(stderr, _("AskQuestionProc needed 4 parameters, got %d\n"),\r
                *nprms);\r
        return;\r
     }\r
@@ -7493,7 +7610,7 @@ void AskQuestionReplyAction(w, event, prms, nprms)
     OutputToProcess(pendingReplyPR, buf, strlen(buf), &err);\r
     AskQuestionPopDown();\r
 \r
-    if (err) DisplayFatalError("Error writing to chess program", err, 0);\r
+    if (err) DisplayFatalError(_("Error writing to chess program"), err, 0);\r
 }\r
 \r
 void AskQuestionCallback(w, client_data, call_data)\r
@@ -7506,7 +7623,7 @@ void AskQuestionCallback(w, client_data, call_data)
     XtSetArg(args[0], XtNlabel, &name);\r
     XtGetValues(w, args, 1);\r
     \r
-    if (strcmp(name, "cancel") == 0) {\r
+    if (strcmp(name, _("cancel")) == 0) {\r
         AskQuestionPopDown();\r
     } else {\r
        AskQuestionReplyAction(w, NULL, NULL, NULL);\r
@@ -7545,9 +7662,9 @@ void AskQuestion(title, question, replyPrefix, pr)
     dialog = XtCreateManagedWidget("question", dialogWidgetClass,\r
                                   layout, args, i);\r
     \r
-    XawDialogAddButton(dialog, "enter", AskQuestionCallback,\r
+    XawDialogAddButton(dialog, _("enter"), AskQuestionCallback,\r
                       (XtPointer) dialog);\r
-    XawDialogAddButton(dialog, "cancel", AskQuestionCallback,\r
+    XawDialogAddButton(dialog, _("cancel"), AskQuestionCallback,\r
                       (XtPointer) dialog);\r
 \r
     XtRealizeWidget(popup);\r
@@ -7658,7 +7775,7 @@ Colorize(cc, continuation)
     count = strlen(buf);\r
     outCount = OutputToProcess(NoProc, buf, count, &error);\r
     if (outCount < count) {\r
-       DisplayFatalError("Error writing to display", error, 1);\r
+       DisplayFatalError(_("Error writing to display"), error, 1);\r
     }\r
 \r
     if (continuation) return;\r
@@ -7731,7 +7848,7 @@ static char *ExpandPathName(path)
            pwd = getpwnam(buf);\r
            if (!pwd)\r
              {\r
-                 fprintf(stderr, "ERROR: Unknown user %s (in path %s)\n",\r
+                 fprintf(stderr, _("ERROR: Unknown user %s (in path %s)\n"),\r
                          buf, path);\r
                  return NULL;\r
              }\r
@@ -7845,7 +7962,8 @@ AnalysisClockCallback(arg, id)
      XtPointer arg;\r
      XtIntervalId *id;\r
 {\r
-    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
+    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile \r
+         || appData.icsEngineAnalyze) { // [DM]\r
        AnalysisPeriodicEvent(0);\r
        StartAnalysisClock();\r
     }\r
@@ -7932,7 +8050,9 @@ DisplayWhiteClock(timeRemaining, highlight)
      int highlight;\r
 {\r
     Arg args[16];\r
-    DisplayTimerLabel(whiteTimerWidget, "White", timeRemaining, highlight);\r
+\r
+    if(appData.noGUI) return;\r
+    DisplayTimerLabel(whiteTimerWidget, _("White"), timeRemaining, highlight);\r
     if (highlight && iconPixmap == bIconPixmap) {\r
        iconPixmap = wIconPixmap;\r
        XtSetArg(args[0], XtNiconPixmap, iconPixmap);\r
@@ -7946,7 +8066,9 @@ DisplayBlackClock(timeRemaining, highlight)
      int highlight;\r
 {\r
     Arg args[16];\r
-    DisplayTimerLabel(blackTimerWidget, "Black", timeRemaining, highlight);\r
+\r
+    if(appData.noGUI) return;\r
+    DisplayTimerLabel(blackTimerWidget, _("Black"), timeRemaining, highlight);\r
     if (highlight && iconPixmap == wIconPixmap) {\r
        iconPixmap = bIconPixmap;\r
        XtSetArg(args[0], XtNiconPixmap, iconPixmap);\r
@@ -8001,7 +8123,7 @@ int StartChildProcess(cmdLine, dir, pr)
     SetUpChildIO(to_prog, from_prog);\r
 \r
     if ((pid = fork()) == 0) {\r
-       /* Child process */
+       /* Child process */\r
        // [HGM] PSWBTM: made order resistant against case where fd of created pipe was 0 or 1\r
        close(to_prog[1]);     // first close the unused pipe ends\r
        close(from_prog[0]);\r
@@ -8009,14 +8131,14 @@ int StartChildProcess(cmdLine, dir, pr)
        dup2(from_prog[1], 1);\r
        if(to_prog[0] >= 2) close(to_prog[0]); // if 0 or 1, the dup2 already cosed the original\r
        close(from_prog[1]);                   // and closing again loses one of the pipes!\r
-       if(fileno(stderr) >= 2) // better safe than sorry...
+       if(fileno(stderr) >= 2) // better safe than sorry...\r
                dup2(1, fileno(stderr)); /* force stderr to the pipe */\r
 \r
        if (dir[0] != NULLCHAR && chdir(dir) != 0) {\r
            perror(dir);\r
            exit(1);\r
-       }
-
+       }\r
+\r
        nice(appData.niceEngines); // [HGM] nice: adjust priority of engine proc\r
 \r
         execvp(argv[0], argv);\r
@@ -8105,7 +8227,7 @@ int OpenTCP(host, port, pr)
      ProcRef *pr;\r
 {\r
 #if OMIT_SOCKETS\r
-    DisplayFatalError("Socket support is not configured in", 0, 2);\r
+    DisplayFatalError(_("Socket support is not configured in"), 0, 2);\r
 #else  /* !OMIT_SOCKETS */\r
     int s;\r
     struct sockaddr_in sa;\r
@@ -8207,7 +8329,7 @@ int OpenRcmd(host, user, cmd, pr)
      char *host, *user, *cmd;\r
      ProcRef *pr;\r
 {\r
-    DisplayFatalError("internal rcmd not implemented for Unix", 0, 1);\r
+    DisplayFatalError(_("internal rcmd not implemented for Unix"), 0, 1);\r
     return -1;\r
 }    \r
 \r
@@ -8933,9 +9055,9 @@ AnimateMove(board, fromX, fromY, toX, toY)
 #endif\r
 \r
   if (appData.debugMode) {\r
-      printf("AnimateMove: piece %d %s from %d,%d to %d,%d \n",\r
-            piece, hop ? "hops" : "slides", fromX, fromY, toX, toY);\r
-  }\r
+      fprintf(debugFP, hop ? _("AnimateMove: piece %d hops from %d,%d to %d,%d \n") :\r
+                             _("AnimateMove: piece %d slides from %d,%d to %d,%d \n"),\r
+             piece, fromX, fromY, toX, toY);  }\r
 \r
   ScreenSquare(fromX, fromY, &start, &startColor);\r
   ScreenSquare(toX, toY, &finish, &endColor);\r
@@ -9089,7 +9211,7 @@ DrawDragPiece ()
 void\r
 SetProgramStats( FrontEndProgramStats * stats )\r
 {\r
-  // [HR] TODO
+  // [HR] TODO\r
   // [HGM] done, but perhaps backend should call this directly?\r
     EngineOutputUpdate( stats );\r
 }\r