tcurses client now translates Yes/No messages etc. - vaccinewars - be a doctor … | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bed0f68f034ad938383e17dabc92e37ef0029dd6 | |
parent bd79d414ea55ce5446266ddfd66005ecbb9bd821 | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 2 Oct 2000 00:30:28 +0000 | |
curses client now translates Yes/No messages etc. | |
Diffstat: | |
M ChangeLog | 1 + | |
M po/dopewars.pot | 108 ++++++++++++++++++-----------… | |
M src/curses_client.c | 50 +++++++++++++++++++++--------… | |
3 files changed, 99 insertions(+), 60 deletions(-) | |
--- | |
diff --git a/ChangeLog b/ChangeLog | |
t@@ -1,5 +1,6 @@ | |
1.4.9 | |
- Completely rewritten fighting code | |
+ - Tense and case-sensitive translated strings | |
- Internationalization (i18n) support | |
- Networking revamped - now uses nonblocking sockets to improve server | |
responsiveness and to remove deadlocks (previously, any client could | |
diff --git a/po/dopewars.pot b/po/dopewars.pot | |
t@@ -6,7 +6,7 @@ | |
msgid "" | |
msgstr "" | |
"Project-Id-Version: PACKAGE VERSION\n" | |
-"POT-Creation-Date: 2000-10-02 00:17+0100\n" | |
+"POT-Creation-Date: 2000-10-02 01:27+0100\n" | |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
"Language-Team: LANGUAGE <[email protected]>\n" | |
t@@ -1088,7 +1088,7 @@ msgstr "" | |
msgid " Are you sure? " | |
msgstr "" | |
-#: src/curses_client.c:544 src/curses_client.c:562 src/curses_client.c:1692 | |
+#: src/curses_client.c:544 src/curses_client.c:562 src/curses_client.c:1710 | |
msgid "YN" | |
msgstr "" | |
t@@ -1193,164 +1193,188 @@ msgstr "" | |
msgid "There isn't that much money in the bank..." | |
msgstr "" | |
-#: src/curses_client.c:1005 | |
+#: src/curses_client.c:953 | |
+msgid "Yes" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:953 | |
+msgid "No" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:953 | |
+msgid "Run" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:954 src/gtk_client.c:525 | |
+msgid "Fight" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:954 | |
+msgid "Attack" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:954 | |
+msgid "Evade" | |
+msgstr "" | |
+ | |
+#: src/curses_client.c:1023 | |
msgid "Press any key..." | |
msgstr "" | |
-#: src/curses_client.c:1136 | |
+#: src/curses_client.c:1154 | |
msgid "Messages" | |
msgstr "" | |
-#: src/curses_client.c:1143 src/gtk_client.c:1415 | |
+#: src/curses_client.c:1161 src/gtk_client.c:1415 | |
msgid "Stats" | |
msgstr "" | |
-#: src/curses_client.c:1146 | |
+#: src/curses_client.c:1164 | |
#, c-format | |
msgid "Cash %17s" | |
msgstr "" | |
-#: src/curses_client.c:1153 | |
+#: src/curses_client.c:1171 | |
#, c-format | |
msgid "Health %3d" | |
msgstr "" | |
-#: src/curses_client.c:1155 | |
+#: src/curses_client.c:1173 | |
#, c-format | |
msgid "Bank %17s" | |
msgstr "" | |
-#: src/curses_client.c:1159 | |
+#: src/curses_client.c:1177 | |
#, c-format | |
msgid "Debt %17s" | |
msgstr "" | |
-#: src/curses_client.c:1163 | |
+#: src/curses_client.c:1181 | |
#, c-format | |
msgid "Space %6d" | |
msgstr "" | |
-#: src/curses_client.c:1165 | |
+#: src/curses_client.c:1183 | |
#, c-format | |
msgid "%s %3d Space %6d" | |
msgstr "" | |
-#: src/curses_client.c:1176 | |
+#: src/curses_client.c:1194 | |
msgid "Trenchcoat" | |
msgstr "" | |
-#: src/curses_client.c:1216 | |
+#: src/curses_client.c:1234 | |
#, c-format | |
msgid "Spy reports for %s" | |
msgstr "" | |
-#: src/curses_client.c:1220 src/curses_client.c:1225 | |
+#: src/curses_client.c:1238 src/curses_client.c:1243 | |
#, c-format | |
msgid "%s..." | |
msgstr "" | |
-#: src/curses_client.c:1246 | |
+#: src/curses_client.c:1264 | |
msgid "No other players are currently logged on!" | |
msgstr "" | |
-#: src/curses_client.c:1251 | |
+#: src/curses_client.c:1269 | |
msgid "Players currently logged on:-" | |
msgstr "" | |
-#: src/curses_client.c:1399 | |
+#: src/curses_client.c:1417 | |
msgid "Hey dude, what's your name? " | |
msgstr "" | |
-#: src/curses_client.c:1434 | |
+#: src/curses_client.c:1452 | |
#, c-format | |
msgid "Hey dude, the prices of %s here are:" | |
msgstr "" | |
-#: src/curses_client.c:1446 | |
+#: src/curses_client.c:1464 | |
msgid "Will you B>uy" | |
msgstr "" | |
-#: src/curses_client.c:1447 | |
+#: src/curses_client.c:1465 | |
msgid ", S>ell" | |
msgstr "" | |
-#: src/curses_client.c:1448 | |
+#: src/curses_client.c:1466 | |
msgid ", D>rop" | |
msgstr "" | |
-#: src/curses_client.c:1449 | |
+#: src/curses_client.c:1467 | |
msgid ", T>alk, P>age, L>ist" | |
msgstr "" | |
-#: src/curses_client.c:1452 | |
+#: src/curses_client.c:1470 | |
msgid ", G>ive" | |
msgstr "" | |
-#: src/curses_client.c:1455 | |
+#: src/curses_client.c:1473 | |
msgid ", F>ight" | |
msgstr "" | |
-#: src/curses_client.c:1459 | |
+#: src/curses_client.c:1477 | |
msgid ", J>et" | |
msgstr "" | |
-#: src/curses_client.c:1461 src/curses_client.c:1476 | |
+#: src/curses_client.c:1479 src/curses_client.c:1494 | |
msgid ", or Q>uit? " | |
msgstr "" | |
-#: src/curses_client.c:1469 | |
+#: src/curses_client.c:1487 | |
msgid "Do you " | |
msgstr "" | |
-#: src/curses_client.c:1471 | |
+#: src/curses_client.c:1489 | |
msgid "F>ight, " | |
msgstr "" | |
-#: src/curses_client.c:1472 | |
+#: src/curses_client.c:1490 | |
msgid "S>tand, " | |
msgstr "" | |
-#: src/curses_client.c:1474 | |
+#: src/curses_client.c:1492 | |
msgid "R>un, " | |
msgstr "" | |
-#: src/curses_client.c:1475 | |
+#: src/curses_client.c:1493 | |
msgid "D>eal " | |
msgstr "" | |
-#: src/curses_client.c:1518 | |
+#: src/curses_client.c:1536 | |
msgid "Connection to server lost! Reverting to single player mode" | |
msgstr "" | |
-#: src/curses_client.c:1547 | |
+#: src/curses_client.c:1565 | |
msgid "BSDTPLGFJQ" | |
msgstr "" | |
-#: src/curses_client.c:1549 | |
+#: src/curses_client.c:1567 | |
msgid "DRFSQ" | |
msgstr "" | |
-#: src/curses_client.c:1577 | |
+#: src/curses_client.c:1595 | |
msgid "List what? P>layers or S>cores? " | |
msgstr "" | |
-#: src/curses_client.c:1578 | |
+#: src/curses_client.c:1596 | |
msgid "PS" | |
msgstr "" | |
-#: src/curses_client.c:1587 | |
+#: src/curses_client.c:1605 | |
msgid "Whom do you want to page (talk privately to) ? " | |
msgstr "" | |
-#: src/curses_client.c:1602 | |
+#: src/curses_client.c:1620 | |
msgid "Talk: " | |
msgstr "" | |
-#: src/curses_client.c:1691 | |
+#: src/curses_client.c:1709 | |
msgid "Play again? " | |
msgstr "" | |
-#: src/curses_client.c:1703 | |
+#: src/curses_client.c:1721 | |
msgid "" | |
"No curses client available - rebuild the binary passing the\n" | |
"--enable-curses-client option to configure, or use a windowed\n" | |
t@@ -1489,10 +1513,6 @@ msgstr "" | |
msgid "OK" | |
msgstr "" | |
-#: src/gtk_client.c:525 | |
-msgid "Fight" | |
-msgstr "" | |
- | |
#: src/gtk_client.c:552 | |
msgid "_Deal %Tde" | |
msgstr "" | |
diff --git a/src/curses_client.c b/src/curses_client.c | |
t@@ -51,7 +51,7 @@ static void display_intro(); | |
static void ResizeHandle(int sig); | |
static void CheckForResize(Player *Play); | |
static int GetKey(char *allowed,char *orig_allowed,gboolean AllowOther, | |
- gboolean PrintAllowed); | |
+ gboolean PrintAllowed,gboolean ExpandOut); | |
static void clear_bottom(), clear_screen(); | |
static void clear_line(int line), clear_exceptfor(int skip); | |
static void nice_wait(); | |
t@@ -257,7 +257,7 @@ static char *SelectServerFromMetaServer() { | |
attrset(PromptAttr); | |
mvaddstr(23,1, | |
_("N>ext server; P>revious server; S>elect this server... ")); | |
- c=GetKey(_("NPS"),"NPS",FALSE,FALSE); | |
+ c=GetKey(_("NPS"),"NPS",FALSE,FALSE,FALSE); | |
switch(c) { | |
case 'S': AssignName(&ServerName,ThisServer->Name); | |
Port=ThisServer->Port; | |
t@@ -331,7 +331,7 @@ static char ConnectToServer(Player *Play) { | |
_(" dopewars -s < /dev/null & )")); | |
mvaddstr(22,1,_(" or P>lay single-player ? ")); | |
attrset(TextAttr); | |
- c=GetKey(_("CLQP"),"CLQP",FALSE,FALSE); | |
+ c=GetKey(_("CLQP"),"CLQP",FALSE,FALSE,FALSE); | |
switch(c) { | |
case 'Q': return FALSE; | |
case 'P': ConnectMethod=CM_SINGLE; | |
t@@ -527,7 +527,7 @@ static void GiveErrand(Player *Play) { | |
mvaddstr(y++,2,_("or N>o errand ? ")); | |
curs_set(1); | |
attrset(TextAttr); | |
- c=GetKey(_("STGCN"),"STGCN",TRUE,FALSE); | |
+ c=GetKey(_("STGCN"),"STGCN",TRUE,FALSE,FALSE); | |
if (Play->Bitches.Carried>0 || c=='C') switch (c) { | |
case 'S': | |
To=ListPlayers(Play,TRUE,_("Whom do you want to spy on? ")); | |
t@@ -541,7 +541,7 @@ static void GiveErrand(Player *Play) { | |
case 'G': | |
attrset(PromptAttr); | |
addstr(_(" Are you sure? ")); | |
- c=GetKey(_("YN"),"YN",FALSE,TRUE); | |
+ c=GetKey(_("YN"),"YN",FALSE,TRUE,FALSE); | |
if (c=='Y') SendClientMessage(Play,C_NONE,C_SACKBITCH,NULL,NULL); | |
break; | |
case 'C': | |
t@@ -559,7 +559,7 @@ static int want_to_quit() { | |
attrset(PromptAttr); | |
mvaddstr(22,1,_("Are you sure you want to quit? ")); | |
attrset(TextAttr); | |
- return (GetKey(_("YN"),"YN",FALSE,TRUE)!='N'); | |
+ return (GetKey(_("YN"),"YN",FALSE,TRUE,FALSE)!='N'); | |
} | |
static void change_name(Player *Play,char nullname) { | |
t@@ -694,7 +694,7 @@ void HandleClientMessage(char *Message,Player *Play) { | |
wrd=GetNextWord(&pt,""); | |
PrintMessage(pt); | |
addch(' '); | |
- i=GetKey(wrd,wrd,FALSE,TRUE); | |
+ i=GetKey(_(wrd),wrd,FALSE,TRUE,TRUE); | |
wrd=g_strdup_printf("%c",i); | |
SendClientMessage(Play,C_NONE,C_ANSWER, | |
From==&Noone ? NULL : From,wrd); | |
t@@ -805,7 +805,7 @@ void GunShop(Player *Play) { | |
clear_line(22); | |
mvaddstr(22,40-strlen(text)/2,text); | |
attrset(TextAttr); | |
- c=GetKey(_("BSL"),"BSL",FALSE,FALSE); | |
+ c=GetKey(_("BSL"),"BSL",FALSE,FALSE,FALSE); | |
if (c=='L') break; | |
if (c=='S' || c=='B') { | |
clear_line(22); | |
t@@ -913,7 +913,7 @@ void Bank(Player *Play) { | |
mvaddstr(18,1,_("Do you want to D>eposit money, W>ithdraw money, " | |
"or L>eave ? ")); | |
attrset(TextAttr); | |
- c=GetKey(_("DWL"),"DWL",FALSE,FALSE); | |
+ c=GetKey(_("DWL"),"DWL",FALSE,FALSE,FALSE); | |
if (c=='L') return; | |
text=nice_input(_("How much money? "),19,1,1,NULL); | |
money=strtoprice(text); g_free(text); | |
t@@ -937,7 +937,7 @@ void Bank(Player *Play) { | |
} | |
int GetKey(char *allowed,char *orig_allowed,gboolean AllowOther, | |
- gboolean PrintAllowed) { | |
+ gboolean PrintAllowed,gboolean ExpandOut) { | |
/* Waits for keyboard input; will only accept a key listed in the */ | |
/* "allowed" string. This string may have been translated; thus */ | |
/* the "orig_allowed" string contains the untranslated keys. */ | |
t@@ -945,7 +945,16 @@ int GetKey(char *allowed,char *orig_allowed,gboolean Allo… | |
/* (e.g. if allowed[2] is pressed, orig_allowed[2] is returned) */ | |
/* Case insensitive. If "AllowOther" is TRUE, keys other than the */ | |
/* given selection are allowed, and cause a zero return value. */ | |
- int i,c; | |
+/* If "PrintAllowed" is TRUE, the allowed keys are printed after */ | |
+/* the prompt. If "ExpandOut" is also TRUE, the full words for */ | |
+/* the commands, rather than just their first letters, are */ | |
+/* displayed. */ | |
+ int i,j,k,c; | |
+ gchar *Words[] = { N_("Yes"), N_("No"), N_("Run"), | |
+ N_("Fight"), N_("Attack"), N_("Evade") }; | |
+ gint numWords = sizeof(Words) / sizeof(Words[0]); | |
+ gchar *trWord; | |
+ | |
curs_set(1); | |
c=0; | |
if (!allowed || strlen(allowed)==0) return 0; | |
t@@ -953,7 +962,16 @@ int GetKey(char *allowed,char *orig_allowed,gboolean Allo… | |
addch('[' | TextAttr); | |
for (i=0;i<strlen(allowed);i++) { | |
if (i>0) addch('/' | TextAttr); | |
- addch((guchar)allowed[i] | TextAttr); | |
+ for (j=0;j<numWords;j++) { | |
+ if (ExpandOut && orig_allowed[i]==Words[j][0]) { | |
+ trWord=_(Words[j]); | |
+ for (k=0;k<strlen(trWord);k++) { | |
+ addch((guchar)trWord[k] | TextAttr); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ if (j>=numWords) addch((guchar)allowed[i] | TextAttr); | |
} | |
addch(']' | TextAttr); | |
addch(' ' | TextAttr); | |
t@@ -1544,9 +1562,9 @@ static void Curses_DoGame(Player *Play) { | |
} | |
#endif /* NETWORKING */ | |
if (DisplayMode==DM_STREET) { | |
- c=GetKey(_("BSDTPLGFJQ"),"BSDTPLGFJQ",TRUE,FALSE); | |
+ c=GetKey(_("BSDTPLGFJQ"),"BSDTPLGFJQ",TRUE,FALSE,FALSE); | |
} else if (DisplayMode==DM_FIGHT) { | |
- c=GetKey(_("DRFSQ"),"DRFSQ",TRUE,FALSE); | |
+ c=GetKey(_("DRFSQ"),"DRFSQ",TRUE,FALSE,FALSE); | |
} else c=0; | |
#if ! (NETWORKING || HAVE_SELECT) | |
CheckForResize(Play); | |
t@@ -1575,7 +1593,7 @@ static void Curses_DoGame(Player *Play) { | |
} else if (c=='L' && Network) { | |
attrset(PromptAttr); | |
mvaddstr(23,20,_("List what? P>layers or S>cores? ")); | |
- i=GetKey(_("PS"),"PS",TRUE,FALSE); | |
+ i=GetKey(_("PS"),"PS",TRUE,FALSE,FALSE); | |
if (i=='P') { | |
ListPlayers(Play,FALSE,NULL); | |
} else if (i=='S') { | |
t@@ -1689,7 +1707,7 @@ void CursesLoop() { | |
CleanUpServer(); | |
attrset(TextAttr); | |
mvaddstr(23,20,_("Play again? ")); | |
- c=GetKey(_("YN"),"YN",TRUE,TRUE); | |
+ c=GetKey(_("YN"),"YN",TRUE,TRUE,FALSE); | |
} | |
g_free(Name); | |
end_curses(); |