Internationalization for WinBoard
[xboard.git] / winboard / wgamelist.c
index d736a8d..e582a46 100644 (file)
@@ -41,6 +41,8 @@
 \r
 #include "wsnap.h"\r
 \r
+#define _(s) T_(s)\r
+\r
 /* Module globals */\r
 static BOOLEAN gameListUp = FALSE;\r
 static FILE* gameFile;\r
@@ -122,7 +124,7 @@ static int GameListUpdateTitle( HWND hDlg, char * pszTitle, int item_count, int
 {\r
     char buf[256];\r
 \r
-    sprintf( buf, "%s - %d/%d games", pszTitle, item_count, item_total );\r
+    sprintf( buf, _("%s - %d/%d games"), pszTitle, item_count, item_total );\r
 \r
     if( stats != 0 ) {\r
         sprintf( buf+strlen(buf), " (%d-%d-%d)", stats->white_wins, stats->black_wins, stats->drawn );\r
@@ -152,6 +154,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
 \r
   switch (message) {\r
   case WM_INITDIALOG: \r
+    Translate(hDlg, DLG_GameList);\r
     GetWindowText( hDlg, szDlgTitle, sizeof(szDlgTitle) );\r
     szDlgTitle[ sizeof(szDlgTitle)-1 ] = '\0';\r
 \r
@@ -200,12 +203,11 @@ GameListDialog(HWND hDlg, UINT message,   WPARAM wParam, LPARAM lParam)
                              newSizeX, newSizeY);\r
        sizeX = newSizeX;\r
        sizeY = newSizeY;\r
-      } \r
-   else \r
-     GetActualPlacement( gameListDialog, &wpGameList );\r
+      } else \r
+        GetActualPlacement( gameListDialog, &wpGameList );\r
 \r
     }\r
-    GameListUpdateTitle( hDlg, "Game List", count, ((ListGame *) gameList.tailPred)->number, &stats );\r
+      GameListUpdateTitle( hDlg, _("Game List"), count, ((ListGame *) gameList.tailPred)->number, &stats ); // [HGM] always update title\r
     return FALSE;\r
     \r
   case WM_SIZE:\r
@@ -264,7 +266,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
       nItem = SendDlgItemMessage(hDlg, OPT_GameListText, LB_GETCURSEL, 0, 0);\r
       if (nItem < 0) {\r
        /* is this possible? */\r
-       DisplayError("No game selected", 0);\r
+       DisplayError(_("No game selected"), 0);\r
        return TRUE;\r
       }\r
       break; /* load the game*/\r
@@ -274,7 +276,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
       nItem++;\r
       if (nItem >= ((ListGame *) gameList.tailPred)->number) {\r
         /* [AS] Removed error message */\r
-       /* DisplayError("Can't go forward any further", 0); */\r
+       /* DisplayError(_("Can't go forward any further"), 0); */\r
        return TRUE;\r
       }\r
       SendDlgItemMessage(hDlg, OPT_GameListText, LB_SETCURSEL, nItem, 0);\r
@@ -285,7 +287,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
       nItem--;\r
       if (nItem < 0) {\r
         /* [AS] Removed error message, added return */\r
-       /* DisplayError("Can't back up any further", 0); */\r
+       /* DisplayError(_("Can't back up any further"), 0); */\r
         return TRUE;\r
       }\r
       SendDlgItemMessage(hDlg, OPT_GameListText, LB_SETCURSEL, nItem, 0);\r
@@ -299,7 +301,7 @@ GameListDialog(HWND hDlg, UINT message,     WPARAM wParam, LPARAM lParam)
             if( GetDlgItemText( hDlg, IDC_GameListFilter, filter, sizeof(filter) ) >= 0 ) {\r
                 filter[ sizeof(filter)-1 ] = '\0';\r
                 count = GameListToListBox( hDlg, TRUE, filter, &stats );\r
-                GameListUpdateTitle( hDlg, "Game List", count, ((ListGame *) gameList.tailPred)->number, &stats );\r
+                GameListUpdateTitle( hDlg, _("Game List"), count, ((ListGame *) gameList.tailPred)->number, &stats );\r
             }\r
         }\r
         return FALSE;\r
@@ -428,7 +430,7 @@ VOID ShowGameListProc()
     if (gameFileName) {\r
       GameListPopUp(gameFile, gameFileName);\r
     } else {\r
-      DisplayError("No game list", 0);\r
+      DisplayError(_("No game list"), 0);\r
     }\r
   }\r
 }\r
@@ -442,7 +444,7 @@ HGLOBAL ExportGameListAsText()
     DWORD dwLen = 0;\r
 \r
     if( ! gameFileName || ((ListGame *) gameList.tailPred)->number <= 0 ) {\r
-        DisplayError("Game list not loaded or empty", 0);\r
+        DisplayError(_(_("Game list not loaded or empty")), 0);\r
         return NULL;\r
     }\r
 \r