1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-12-04 14:46:45 -05:00

Place all output strings within gettext invocations

This commit is contained in:
John Zaitseff 2011-08-16 21:03:41 +10:00
parent bf76fa312c
commit 6c1c272780
6 changed files with 312 additions and 298 deletions

View File

@ -95,9 +95,9 @@ void exchange_stock (void)
box(curwin, 0, 0);
center(curwin, 1, 0, attr_title, 0, 0, 1,
" Interstellar Stock Exchange ");
_(" Interstellar Stock Exchange "));
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
"Player: ^{%s^}", player[current_player].name);
_("Player: ^{%s^}"), player[current_player].name);
all_off_map = true;
for (i = 0; i < MAX_COMPANIES; i++) {
@ -109,20 +109,20 @@ void exchange_stock (void)
if (all_off_map) {
center(curwin, 8, 0, attr_normal, attr_highlight, 0, 1,
"No companies on the map");
_("No companies on the map"));
} else {
mvwhline(curwin, 4, 2, ' ' | attr_subtitle, w - 4);
mvwhline(curwin, 5, 2, ' ' | attr_subtitle, w - 4);
left(curwin, 4, 4, attr_subtitle, 0, 0, 2, "\nCompany");
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2, "Shares\nleft");
left(curwin, 4, 4, attr_subtitle, 0, 0, 2, _("\nCompany"));
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2, _("Shares\nleft"));
right(curwin, 4, w - 6 - STOCK_LEFT_COLS, attr_subtitle, 0, 0,
2, "Shares\nissued");
2, _("Shares\nissued"));
right(curwin, 4, w - 8 - STOCK_LEFT_COLS - STOCK_ISSUED_COLS,
attr_subtitle, 0, 0, 2, "Return\n(%%)");
attr_subtitle, 0, 0, 2, _("Return\n(%%)"));
right(curwin, 4, w - 10 - STOCK_LEFT_COLS - STOCK_ISSUED_COLS
- SHARE_RETURN_COLS, attr_subtitle, 0, 0, 2,
"Price per\nshare (%s)", lconvinfo.currency_symbol);
_("Price per\nshare (%s)"), lconvinfo.currency_symbol);
for (line = 6, i = 0; i < MAX_COMPANIES; i++) {
if (company[i].on_map) {
@ -154,16 +154,16 @@ void exchange_stock (void)
newtxwin(6, WIN_COLS, 18, WCENTER, true, attr_normal_window);
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
"^{<1>^} Display stock portfolio");
_("^{<1>^} Display stock portfolio"));
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
"^{<2>^} Display galaxy map");
_("^{<2>^} Display galaxy map"));
left(curwin, 3, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<3>^} Visit the Trading Bank");
_("^{<3>^} Visit the Trading Bank"));
left(curwin, 4, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<4>^} Exit the Stock Exchange");
_("^{<4>^} Exit the Stock Exchange"));
center(curwin, 1, -1, attr_normal, attr_keycode, attr_highlight, 1,
"Enter selection [^[Company letter^]/^{1^}-^{4^}]: ");
_("Enter selection [^[Company letter^]/^{1^}-^{4^}]: "));
curs_set(CURS_ON);
wrefresh(curwin);
@ -263,25 +263,26 @@ void visit_bank (void)
// Show the informational part of the Bank
newtxwin(10, WIN_COLS - 4, 5, WCENTER, true, attr_normal_window);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Interstellar Trading Bank ");
center(curwin, 1, 0, attr_title, 0, 0, 1,
_(" Interstellar Trading Bank "));
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) - 4, &width,
1, "Current cash: ");
1, _("Current cash: "));
x = (getmaxx(curwin) + width - (BANK_VALUE_COLS + 2)) / 2;
rightch(curwin, 3, x, chbuf, 1, &width);
right(curwin, 3, x + BANK_VALUE_COLS + 2, attr_normal, attr_highlight, 0,
1, " ^{%N^} ", player[current_player].cash);
right(curwin, 4, x, attr_normal, 0, 0, 1, "Current debt: ");
right(curwin, 4, x, attr_normal, 0, 0, 1, _("Current debt: "));
right(curwin, 4, x + BANK_VALUE_COLS + 2, attr_normal, attr_highlight, 0,
1, " ^{%N^} ", player[current_player].debt);
right(curwin, 5, x, attr_normal, 0, 0, 1, "Interest rate: ");
right(curwin, 5, x, attr_normal, 0, 0, 1, _("Interest rate: "));
right(curwin, 5, x + BANK_VALUE_COLS + 2, attr_normal, attr_highlight, 0,
1, " ^{%.2f%%^} ", interest_rate * 100.0);
right(curwin, 7, x, attr_highlight, 0, 0, 1, "Credit limit: ");
right(curwin, 7, x, attr_highlight, 0, 0, 1, _("Credit limit: "));
whline(curwin, ' ' | attr_title, BANK_VALUE_COLS + 2);
right(curwin, 7, x + BANK_VALUE_COLS + 2, attr_title, 0, 0, 1,
" %N ", credit_limit);
@ -292,14 +293,14 @@ void visit_bank (void)
newtxwin(7, WIN_COLS - 4, 15, WCENTER, true, attr_normal_window);
center(curwin, 3, 0, attr_normal, attr_keycode, 0, 1,
"^{<1>^} Borrow money ");
_("^{<1>^} Borrow money "));
center(curwin, 4, 0, attr_normal, attr_keycode, 0, 1,
"^{<2>^} Repay debt ");
_("^{<2>^} Repay debt "));
center(curwin, 5, 0, attr_normal, attr_keycode, 0, 1,
"^{<3>^} Exit from the Bank");
_("^{<3>^} Exit from the Bank"));
center(curwin, 1, 0, attr_normal, attr_keycode, 0, 1,
"Enter selection [^{1^}-^{3^}]: ");
_("Enter selection [^{1^}-^{3^}]: "));
curs_set(CURS_ON);
wrefresh(curwin);
@ -338,8 +339,8 @@ void visit_bank (void)
if (credit_limit == 0.0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Insufficient Credit Limit ",
"The Bank will not lend you any more money.");
attr_error_waitforkey, _(" Insufficient Credit Limit "),
_("The Bank will not lend you any more money."));
} else {
chtype *chbuf_cursym;
int width_cursym;
@ -359,7 +360,7 @@ void visit_bank (void)
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- BANK_INPUT_COLS - width_cursym - 6, &width, 1,
"How much do you wish to borrow? ");
_("How much do you wish to borrow? "));
x = (getmaxx(curwin) + width - BANK_INPUT_COLS - width_cursym
- n) / 2;
rightch(curwin, 3, x, chbuf, 1, &width);
@ -391,13 +392,13 @@ void visit_bank (void)
if (player[current_player].debt == 0.0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " No Debt ",
"You have no debt to repay.");
attr_error_waitforkey, _(" No Debt "),
_("You have no debt to repay."));
} else if (player[current_player].cash == 0.0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " No Cash ",
"You have no cash with which to repay the debt!");
attr_error_waitforkey, _(" No Cash "),
_("You have no cash with which to repay the debt!"));
} else {
chtype *chbuf_cursym;
int width_cursym;
@ -417,7 +418,7 @@ void visit_bank (void)
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- BANK_INPUT_COLS - width_cursym - 6, &width, 1,
"How much do you wish to repay? ");
_("How much do you wish to repay? "));
x = (getmaxx(curwin) + width - BANK_INPUT_COLS - width_cursym
- n) / 2;
rightch(curwin, 3, x, chbuf, 1, &width);
@ -490,36 +491,36 @@ void trade_shares (int num, bool *bid_used)
newtxwin(9, WIN_COLS - 4, 5, WCENTER, true, attr_normal_window);
w = getmaxx(curwin);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Stock Transaction in %s ",
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" Stock Transaction in %s "),
company[num].name);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, w / 2, &width, 1,
"Shares issued: ");
_("Shares issued: "));
leftch(curwin, 3, 2, chbuf, 1, &width);
right(curwin, 3, width + SHARE_PRICE_COLS + 2, attr_normal, attr_highlight,
0, 1, "^{%'ld^}", company[num].stock_issued);
left(curwin, 4, 2, attr_normal, 0, 0, 1, "Shares left: ");
left(curwin, 4, 2, attr_normal, 0, 0, 1, _("Shares left: "));
right(curwin, 4, width + SHARE_PRICE_COLS + 2, attr_normal, attr_highlight,
0, 1, "^{%'ld^}", company[num].max_stock - company[num].stock_issued);
left(curwin, 5, 2, attr_normal, 0, 0, 1, "Price per share: ");
left(curwin, 5, 2, attr_normal, 0, 0, 1, _("Price per share: "));
right(curwin, 5, width + SHARE_PRICE_COLS + 2, attr_normal, attr_highlight,
0, 1, "^{%N^}", company[num].share_price);
left(curwin, 6, 2, attr_normal, 0, 0, 1, "Return: ");
left(curwin, 6, 2, attr_normal, 0, 0, 1, _("Return: "));
right(curwin, 6, width + SHARE_PRICE_COLS + 2, attr_normal, attr_highlight,
0, 1, "^{%.2f%%^}", company[num].share_return * 100.0);
left(curwin, 3, w / 2, attr_normal, 0, 0, 1, "Current holdings: ");
left(curwin, 3, w / 2, attr_normal, 0, 0, 1, _("Current holdings: "));
right(curwin, 3, w - 2, attr_normal, attr_highlight, 0, 1, " ^{%'ld^} ",
player[current_player].stock_owned[num]);
left(curwin, 4, w / 2, attr_normal, 0, 0, 1, "Percentage owned: ");
left(curwin, 4, w / 2, attr_normal, 0, 0, 1, _("Percentage owned: "));
right(curwin, 4, w - 2, attr_normal, attr_highlight, 0, 1, " ^{%.2f%%^} ",
ownership * 100.0);
left(curwin, 6, w / 2, attr_highlight, 0, 0, 1, "Current cash: ");
left(curwin, 6, w / 2, attr_highlight, 0, 0, 1, _("Current cash: "));
whline(curwin, ' ' | attr_title, TRADE_VALUE_COLS + 2);
right(curwin, 6, w - 2, attr_title, 0, 0, 1, " %N ",
player[current_player].cash);
@ -530,16 +531,16 @@ void trade_shares (int num, bool *bid_used)
newtxwin(7, WIN_COLS - 4, 14, WCENTER, true, attr_normal_window);
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
"^{<1>^} Buy stock from company");
_("^{<1>^} Buy stock from company"));
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
"^{<2>^} Sell stock back to company");
_("^{<2>^} Sell stock back to company"));
left(curwin, 3, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<3>^} Bid company to issue more shares");
_("^{<3>^} Bid company to issue more shares"));
left(curwin, 4, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<4>^} Exit to the Stock Exchange");
_("^{<4>^} Exit to the Stock Exchange"));
center(curwin, 1, 0, attr_normal, attr_keycode, 0, 1,
"Enter selection [^{1^}-^{4^}]: ");
_("Enter selection [^{1^}-^{4^}]: "));
curs_set(CURS_ON);
wrefresh(curwin);
@ -581,14 +582,14 @@ void trade_shares (int num, bool *bid_used)
if (company[num].max_stock - company[num].stock_issued == 0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " No Shares Available ",
"No more shares are available for purchase.");
attr_error_waitforkey, _(" No Shares Available "),
_("No more shares are available for purchase."));
} else if (maxshares <= 0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Insufficient Cash ",
"You do not have enough cash\n"
"to purchase additional shares.");
attr_error_waitforkey, _(" Insufficient Cash "),
_("You do not have enough cash\n"
"to purchase additional shares."));
} else {
maxshares = MIN(maxshares, company[num].max_stock -
company[num].stock_issued);
@ -598,11 +599,11 @@ void trade_shares (int num, bool *bid_used)
box(curwin, 0, 0);
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
"You can purchase up to ^{%'ld^} shares.", maxshares);
_("You can purchase up to ^{%'ld^} shares."), maxshares);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- TRADE_INPUT_COLS - 4, &width, 1,
"How many shares do you wish to purchase? ");
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1,
getmaxx(curwin) - TRADE_INPUT_COLS - 4, &width, 1,
_("How many shares do you wish to purchase? "));
x = (getmaxx(curwin) + width - TRADE_INPUT_COLS) / 2;
rightch(curwin, 4, x, chbuf, 1, &width);
@ -623,19 +624,19 @@ void trade_shares (int num, bool *bid_used)
if (maxshares == 0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " No Shares ",
"You do not have any shares to sell.");
attr_error_waitforkey, _(" No Shares "),
_("You do not have any shares to sell."));
} else {
wbkgdset(curwin, attr_normal_window);
werase(curwin);
box(curwin, 0, 0);
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
"You can sell up to ^{%'ld^} shares.", maxshares);
_("You can sell up to ^{%'ld^} shares."), maxshares);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- TRADE_INPUT_COLS - 4, &width, 1,
"How many shares do you wish to sell? ");
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1,
getmaxx(curwin) - TRADE_INPUT_COLS - 4, &width, 1,
_("How many shares do you wish to sell? "));
x = (getmaxx(curwin) + width - TRADE_INPUT_COLS) / 2;
rightch(curwin, 4, x, chbuf, 1, &width);
@ -663,14 +664,14 @@ void trade_shares (int num, bool *bid_used)
if (maxshares == 0) {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " No Shares Issued ",
"%s has refused\nto issue more shares.",
attr_error_waitforkey, _(" No Shares Issued "),
_("%s has refused\nto issue more shares."),
company[num].name);
} else {
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_normal_window,
attr_title, attr_normal, attr_highlight, 0,
attr_waitforkey, " Shares Issued ",
"%s has issued\n^{%'ld^} more shares.",
attr_waitforkey, _(" Shares Issued "),
_("%s has issued\n^{%'ld^} more shares."),
company[num].name, maxshares);
}
break;

View File

@ -231,17 +231,18 @@ bool load_game (int num)
// File not found
txdlgbox(MAX_DLG_LINES, 50, 9, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Game Not Found ",
"Game %d has not been saved to disk.", num);
attr_error_waitforkey, _(" Game Not Found "),
_("Game %d has not been saved to disk."), num);
} else {
// Some other file error
saved_errno = errno;
txdlgbox(MAX_DLG_LINES, 60, 9, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight,
attr_error_normal, 0, attr_error_waitforkey,
" Game Not Loaded ",
"Game %d could not be loaded from disk.\n\n"
"^{File %s: %s^}", num, filename, strerror(saved_errno));
_(" Game Not Loaded "),
_("Game %d could not be loaded from disk.\n\n"
"^{File %s: %s^}"), num, filename,
strerror(saved_errno));
}
free(buf);
@ -430,9 +431,9 @@ bool save_game (int num)
txdlgbox(MAX_DLG_LINES, 60, 7, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight,
attr_error_normal, 0, attr_error_waitforkey,
" Game Not Saved ",
"Game %d could not be saved to disk.\n\n"
"^{Directory %s: %s^}", num, data_dir,
_(" Game Not Saved "),
_("Game %d could not be saved to disk.\n\n"
"^{Directory %s: %s^}"), num, data_dir,
strerror(saved_errno));
free(buf);
@ -451,9 +452,9 @@ bool save_game (int num)
txdlgbox(MAX_DLG_LINES, 60, 7, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight,
attr_error_normal, 0, attr_error_waitforkey,
" Game Not Saved ",
"Game %d could not be saved to disk.\n\n"
"^{File %s: %s^}", num, filename, strerror(saved_errno));
_(" Game Not Saved "),
_("Game %d could not be saved to disk.\n\n"
"^{File %s: %s^}"), num, filename, strerror(saved_errno));
free(buf);
free(filename);

View File

@ -114,7 +114,7 @@ void init_game (void)
int width;
mkchstr(chbuf, BUFSIZE, attr_status_window, 0, 0, 1, WIN_COLS - 7,
&width, 1, "Loading game %d... ", game_num);
&width, 1, _("Loading game %d... "), game_num);
newtxwin(5, width + 5, 6, WCENTER, true, attr_status_window);
centerch(curwin, 2, 0, chbuf, 1, &width);
wrefresh(curwin);
@ -149,7 +149,7 @@ void init_game (void)
mkchstr(chbuf, BUFSIZE, attr_status_window, 0, 0, 1,
WIN_COLS - 7, &width, 1,
"Loading game %d... ", game_num);
_("Loading game %d... "), game_num);
newtxwin(5, width + 5, 9, WCENTER, true, attr_status_window);
centerch(curwin, 2, 0, chbuf, 1, &width);
wrefresh(curwin);
@ -171,26 +171,24 @@ void init_game (void)
}
if (! game_loaded) {
int i, j, x, y;
ask_player_names();
deltxwin(); // "Number of players" window
txrefresh();
// Initialise player data (other than names)
for (i = 0; i < number_players; i++) {
for (int i = 0; i < number_players; i++) {
player[i].cash = INITIAL_CASH;
player[i].debt = 0.0;
player[i].in_game = true;
for (j = 0; j < MAX_COMPANIES; j++) {
for (int j = 0; j < MAX_COMPANIES; j++) {
player[i].stock_owned[j] = 0;
}
}
// Initialise company data
for (i = 0; i < MAX_COMPANIES; i++) {
for (int i = 0; i < MAX_COMPANIES; i++) {
company[i].name = xstrdup(gettext(company_name[i]));
company[i].share_price = 0.0;
company[i].share_return = INITIAL_RETURN;
@ -200,8 +198,8 @@ void init_game (void)
}
// Initialise galaxy map
for (x = 0; x < MAX_X; x++) {
for (y = 0; y < MAX_Y; y++) {
for (int x = 0; x < MAX_X; x++) {
for (int y = 0; y < MAX_Y; y++) {
galaxy_map[x][y] = (randf() < STAR_RATIO) ?
MAP_STAR : MAP_EMPTY;
}
@ -222,8 +220,8 @@ void init_game (void)
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_normal_window,
attr_title, attr_normal, attr_highlight, 0,
attr_waitforkey, " First Player ",
"The first player to go is ^{%s^}.",
attr_waitforkey, _(" First Player "),
_("The first player to go is ^{%s^}."),
player[first_player].name);
txrefresh();
}
@ -248,11 +246,12 @@ static int ask_number_players (void)
chbuf = xmalloc(BUFSIZE * sizeof(chtype));
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 2, WIN_COLS
- 7, widthbuf, 2, "Enter number of players [^{1^}-^{%d^}] "
"or ^{<C>^} to continue a game: ", MAX_PLAYERS);
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 2,
WIN_COLS - 7, widthbuf, 2,
_("Enter number of players [^{1^}-^{%d^}] "
"or ^{<C>^} to continue a game: "), MAX_PLAYERS);
assert(lines == 1 || lines == 2);
maxwidth = ((lines == 1) ? widthbuf[0] : MAX(widthbuf[0], widthbuf[1])) + 5;
maxwidth = (lines == 1 ? widthbuf[0] : MAX(widthbuf[0], widthbuf[1])) + 5;
newtxwin(lines + 4, maxwidth, 3, WCENTER, true, attr_normal_window);
leftch(curwin, 2, 2, chbuf, lines, widthbuf);
@ -311,11 +310,12 @@ int ask_game_number (void)
chbuf = xmalloc(BUFSIZE * sizeof(chtype));
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 2, WIN_COLS
- 7, widthbuf, 2, "Enter game number [^{1^}-^{9^}] "
"or ^{<CTRL><C>^} to cancel: ");
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 2,
WIN_COLS - 7, widthbuf, 2,
_("Enter game number [^{1^}-^{9^}] "
"or ^{<CTRL><C>^} to cancel: "));
assert(lines == 1 || lines == 2);
maxwidth = ((lines == 1) ? widthbuf[0] : MAX(widthbuf[0], widthbuf[1])) + 5;
maxwidth = (lines == 1 ? widthbuf[0] : MAX(widthbuf[0], widthbuf[1])) + 5;
newtxwin(lines + 4, maxwidth, 6, WCENTER, true, attr_normal_window);
leftch(curwin, 2, 2, chbuf, lines, widthbuf);
@ -368,7 +368,7 @@ void ask_player_names (void)
// Ask for the player's name
newtxwin(5, WIN_COLS - 4, 9, WCENTER, true, attr_normal_window);
left(curwin, 2, 2, attr_normal, 0, 0, 1, "Please enter your name: ");
left(curwin, 2, 2, attr_normal, 0, 0, 1, _("Please enter your name: "));
int x = getcurx(curwin);
int w = getmaxx(curwin) - x - 2;
@ -386,7 +386,7 @@ void ask_player_names (void)
mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 1,
WIN_COLS - YESNO_COLS - 6, &width, 1,
"Do you need any instructions? [^{Y^}/^{N^}] ");
_("Do you need any instructions? [^{Y^}/^{N^}] "));
newtxwin(5, width + YESNO_COLS + 4, 6, WCENTER, true,
attr_normal_window);
leftch(curwin, 2, 2, chbuf, 1, &width);
@ -404,12 +404,13 @@ void ask_player_names (void)
newtxwin(number_players + 5, WIN_COLS - 4, 9, WCENTER,
true, attr_normal_window);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Enter Player Names ");
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" Enter Player Names "));
for (i = 0; i < number_players; i++) {
player[i].name = NULL;
entered[i] = false;
left(curwin, i + 3, 2, attr_normal, 0, 0, 1, "Player %d:", i + 1);
left(curwin, i + 3, 2, attr_normal, 0, 0, 1,
_("Player %d:"), i + 1);
}
int x = getcurx(curwin) + 1;
@ -487,7 +488,7 @@ void ask_player_names (void)
mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0, 1,
WIN_COLS - YESNO_COLS - 6, &width, 1,
"Does any player need instructions? [^{Y^}/^{N^}] ");
_("Does any player need instructions? [^{Y^}/^{N^}] "));
newtxwin(5, width + YESNO_COLS + 4, 6, WCENTER, true,
attr_normal_window);
leftch(curwin, 2, 2, chbuf, 1, &width);
@ -509,8 +510,7 @@ void ask_player_names (void)
void end_game (void)
{
chtype *chbuf;
int lines;
int widthbuf[5];
int lines, widthbuf[5];
if (abort_game) {
@ -522,8 +522,8 @@ void end_game (void)
txdlgbox(MAX_DLG_LINES, 50, 9, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Game Over ",
"The game is over after %d turns.", turn_number - 1);
attr_error_waitforkey, _(" Game Over "),
_("The game is over after %d turns."), turn_number - 1);
for (int i = 0; i < number_players; i++) {
show_status(i);
@ -532,7 +532,7 @@ void end_game (void)
if (number_players == 1) {
txdlgbox(MAX_DLG_LINES, 60, 8, WCENTER, attr_normal_window,
attr_title, attr_normal, attr_highlight, 0, attr_waitforkey,
" Total Value ", "Your total value was ^{%N^}.",
_(" Total Value "), _("Your total value was ^{%N^}."),
total_value(0));
} else {
// Sort players on the basis of total value
@ -541,33 +541,35 @@ void end_game (void)
}
qsort(player, number_players, sizeof(player_info_t), cmp_player);
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_highlight, attr_blink,
5, WIN_COLS - 8, widthbuf, 5, (player[0].sort_value == 0) ?
"The winner is ^{%s^}\n"
"who is ^[*** BANKRUPT ***^]" :
"The winner is ^{%s^}\n"
"with a value of ^{%N^}.", player[0].name,
player[0].sort_value);
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_highlight,
attr_blink, 5, WIN_COLS - 8, widthbuf, 5,
(player[0].sort_value == 0) ?
_("The winner is ^{%s^}\n"
"who is ^[*** BANKRUPT ***^]") :
_("The winner is ^{%s^}\n"
"with a value of ^{%N^}."),
player[0].name, player[0].sort_value);
newtxwin(number_players + lines + 8, WIN_COLS - 4, 3, WCENTER,
true, attr_normal_window);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Game Winner ");
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" Game Winner "));
centerch(curwin, 3, 0, chbuf, lines, widthbuf);
mvwhline(curwin, lines + 4, 2, ' ' | attr_subtitle,
getmaxx(curwin) - 4);
int w = getmaxx(curwin);
mvwhline(curwin, lines + 4, 2, ' ' | attr_subtitle, w - 4);
left(curwin, lines + 4, ORDINAL_COLS + 4, attr_subtitle, 0, 0, 1,
"Player");
right(curwin, lines + 4, getmaxx(curwin) - 4, attr_subtitle, 0, 0, 1,
"Total Value (%s)", lconvinfo.currency_symbol);
_("Player"));
right(curwin, lines + 4, w - 4, attr_subtitle, 0, 0, 1,
_("Total Value (%s)"), lconvinfo.currency_symbol);
for (int i = 0; i < number_players; i++) {
right(curwin, i + lines + 5, ORDINAL_COLS + 2, attr_normal, 0, 0,
1, gettext(ordinal[i + 1]));
left(curwin, i + lines + 5, ORDINAL_COLS + 4, attr_normal, 0, 0,
1, "%s", player[i].name);
right(curwin, i + lines + 5, getmaxx(curwin) - 2, attr_normal, 0,
0, 1, " %!N ", player[i].sort_value);
right(curwin, i + lines + 5, w - 2, attr_normal, 0, 0,
1, " %!N ", player[i].sort_value);
}
wait_for_key(curwin, getmaxy(curwin) - 2, attr_waitforkey);
@ -583,9 +585,6 @@ void end_game (void)
void show_map (bool closewin)
{
int x, y;
newtxwin(MAX_Y + 4, WIN_COLS, 1, WCENTER, true, attr_map_window);
// Draw various borders and highlights
@ -596,16 +595,16 @@ void show_map (bool closewin)
// Display current player and turn number
left(curwin, 1, 2, attr_mapwin_title, attr_mapwin_highlight, 0, 1,
" Player: ^{%s^} ", player[current_player].name);
_(" Player: ^{%s^} "), player[current_player].name);
right(curwin, 1, getmaxx(curwin) - 2, attr_mapwin_title,
attr_mapwin_highlight, attr_mapwin_blink, 1,
(turn_number != max_turn) ? " Turn: ^{%d^} " :
" ^[*** Last Turn ***^] ", turn_number);
(turn_number != max_turn) ? _(" Turn: ^{%d^} ") :
_(" ^[*** Last Turn ***^] "), turn_number);
// Display the actual map
for (y = 0; y < MAX_Y; y++) {
for (int y = 0; y < MAX_Y; y++) {
wmove(curwin, y + 3, 2);
for (x = 0; x < MAX_X; x++) {
for (int x = 0; x < MAX_X; x++) {
map_val_t m = galaxy_map[x][y];
switch (m) {
@ -659,14 +658,14 @@ void show_status (int num)
newtxwin(MAX_COMPANIES + 15, WIN_COLS, 1, WCENTER, true,
attr_normal_window);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Stock Portfolio ");
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1, "Player: ^{%s^}",
player[num].name);
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" Stock Portfolio "));
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
_("Player: ^{%s^}"), player[num].name);
val = total_value(num);
if (val == 0.0) {
center(curwin, 11, 0, attr_normal, attr_highlight, attr_blink, 1,
"^[* * * B A N K R U P T * * *^]");
_("^[* * * B A N K R U P T * * *^]"));
} else {
w = getmaxx(curwin);
@ -681,20 +680,22 @@ void show_status (int num)
if (none) {
center(curwin, 8, 0, attr_normal, attr_highlight, 0, 1,
"No companies on the map");
_("No companies on the map"));
} else {
mvwhline(curwin, 4, 2, ' ' | attr_subtitle, w - 4);
mvwhline(curwin, 5, 2, ' ' | attr_subtitle, w - 4);
left(curwin, 4, 4, attr_subtitle, 0, 0, 2, "\nCompany");
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2, "Ownership\n(%%)");
right(curwin, 4, w - 6 - OWNERSHIP_COLS, attr_subtitle, 0, 0,
2, "Holdings\n(shares)");
left(curwin, 4, 4, attr_subtitle, 0, 0, 2,
_("\nCompany"));
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2,
_("Ownership\n(%%)"));
right(curwin, 4, w - 6 - OWNERSHIP_COLS, attr_subtitle, 0, 0, 2,
_("Holdings\n(shares)"));
right(curwin, 4, w - 8 - OWNERSHIP_COLS - STOCK_OWNED_COLS,
attr_subtitle, 0, 0, 2, "Return\n(%%)");
attr_subtitle, 0, 0, 2, _("Return\n(%%)"));
right(curwin, 4, w - 10 - OWNERSHIP_COLS - STOCK_OWNED_COLS
- SHARE_RETURN_COLS, attr_subtitle, 0, 0, 2,
"Price per\nshare (%s)", lconvinfo.currency_symbol);
_("Price per\nshare (%s)"), lconvinfo.currency_symbol);
for (line = 6, i = 0; i < MAX_COMPANIES; i++) {
if (company[i].on_map) {
@ -725,24 +726,24 @@ void show_status (int num)
int width, x;
mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, w / 2, &width, 1,
"Total value: ");
_("Total value: "));
x = (w + width - (TOTAL_VALUE_COLS + 2)) / 2;
right(curwin, line, x, attr_normal, attr_highlight, 0, 1,
"Current cash: ");
_("Current cash: "));
right(curwin, line, x + TOTAL_VALUE_COLS + 2, attr_normal,
attr_highlight, 0, 1, " ^{%N^} ", player[num].cash);
line++;
if (player[num].debt != 0.0) {
right(curwin, line, x, attr_normal, attr_highlight, 0, 1,
"Current debt: ");
_("Current debt: "));
right(curwin, line, x + TOTAL_VALUE_COLS + 2, attr_normal,
attr_highlight, 0, 1, " ^{%N^} ", player[num].debt);
line++;
right(curwin, line, x, attr_normal, attr_highlight, 0, 1,
"Interest rate: ");
_("Interest rate: "));
right(curwin, line, x + TOTAL_VALUE_COLS + 2, attr_normal,
attr_highlight, 0, 1, " ^{%.2f%%^} ", interest_rate * 100.0);
line++;
@ -768,13 +769,12 @@ void show_status (int num)
double total_value (int num)
{
double val;
int i;
assert(num >= 0 && num < number_players);
val = player[num].cash - player[num].debt;
for (i = 0; i < MAX_COMPANIES; i++) {
for (int i = 0; i < MAX_COMPANIES; i++) {
if (company[i].on_map) {
val += player[num].stock_owned[i] * company[i].share_price;
}

View File

@ -36,110 +36,116 @@
************************************************************************/
static const char *help_text[] = {
"^BStar Traders^N is a simple game of interstellar trading. The object of the\n"
"game is to amass the greatest amount of wealth possible. This is done by\n"
"creating interstellar shipping lanes, expanding them and buying shares in\n"
"the companies controlling them. Shares appreciate in value as company\n"
"operations expand. In addition, the return on each share (as a percentage)\n"
"also changes. Players may also borrow from the Interstellar Trading Bank to\n"
"finance additional purchases on the Stock Exchange.\n"
"\n"
"The map of the galaxy is represented by a ^B~x^N x ^B~y^N grid. A typical section\n"
"of it may be:\n"
"\n"
" ^e . . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . . . . . . . ^N ^e . ^N represents ^Bempty space^N,\n"
" ^e . ^s*^e . . . . . . . ^N ^s * ^N represents a ^Bstar^N.\n"
" ^e . . . . . . . ^s*^e . ^N\n"
" ^e . . . . ^s*^e . . . . ^N\n"
,
N_(""
"^BStar Traders^N is a simple game of interstellar trading. The object of the\n"
"game is to amass the greatest amount of wealth possible. This is done by\n"
"creating interstellar shipping lanes, expanding them and buying shares in\n"
"the companies controlling them. Shares appreciate in value as company\n"
"operations expand. In addition, the return on each share (as a percentage)\n"
"also changes. Players may also borrow from the Interstellar Trading Bank to\n"
"finance additional purchases on the Stock Exchange.\n"
"\n"
"The map of the galaxy is represented by a ^B~x^N x ^B~y^N grid. A typical section\n"
"of it may be:\n"
"\n"
" ^e . . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . . . . . . . ^N ^e . ^N represents ^Bempty space^N,\n"
" ^e . ^s*^e . . . . . . . ^N ^s * ^N represents a ^Bstar^N.\n"
" ^e . . . . . . . ^s*^e . ^N\n"
" ^e . . . . ^s*^e . . . . ^N\n"
""),
"The computer selects ^B~m^N moves (labeled ^k~1^N to ^k~M^N) at random, and places these\n"
"on the map. To select any of the highlighted positions, press that letter.\n"
"As an example, some of the moves on the map may be:\n"
"\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^k~3^e . . . . . ^N\n"
" ^e . ^s*^e . . . . ^k~5^e . . ^N Moves ^k~1^N to ^k~5^N shown.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e . ^N\n"
" ^e . . . . ^s*^e . . . . ^N\n"
"\n"
"\n"
"Selecting a position that is ^Bnot^N next to a star (such as moves ^k~1^N, ^k~3^N or ^k~5^N)\n"
"will set up an ^Boutpost^N, not belonging to any company. Thus, if move ^k~3^N was\n"
"selected on the above map, a ^o + ^N would be placed at that position.\n"
,
N_(""
"The computer selects ^B~m^N moves (labeled ^k~1^N to ^k~M^N) at random, and places these\n"
"on the map. To select any of the highlighted positions, press that letter.\n"
"As an example, some of the moves on the map may be:\n"
"\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^k~3^e . . . . . ^N\n"
" ^e . ^s*^e . . . . ^k~5^e . . ^N Moves ^k~1^N to ^k~5^N shown.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e . ^N\n"
" ^e . . . . ^s*^e . . . . ^N\n"
"\n"
"\n"
"Selecting a position that is ^Bnot^N next to a star (such as moves ^k~1^N, ^k~3^N or ^k~5^N)\n"
"will set up an ^Boutpost^N, not belonging to any company. Thus, if move ^k~3^N was\n"
"selected on the above map, a ^o + ^N would be placed at that position.\n"
""),
"If, on the other hand, a position next to a star (or another outpost) is\n"
"selected, a ^Bcompany^N would be formed and its first letter would appear on the\n"
"map. As a reward for creating the company, you are granted the first five\n"
"shares. Up to ^B~c^N companies can be created in this way.\n"
"\n"
"If a position next to an existing company is selected, the company would\n"
"expand its operations by one square. This increases the cost of its shares\n"
"and hence your return. Thus, if the map was as shown below, selecting ^k~6^N\n"
"or ^k~8^N increases Company ^B~B^N's shipping lane:\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^o+^e . . ^k~6^e . . ^N\n"
" ^e . ^s*^e . . . . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~6^N or ^k~8^N increases Company ^B~B^N.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . . . ^k~8^e ^N\n"
,
N_(""
"If, on the other hand, a position next to a star (or another outpost) is\n"
"selected, a ^Bcompany^N would be formed and its first letter would appear on the\n"
"map. As a reward for creating the company, you are granted the first five\n"
"shares. Up to ^B~c^N companies can be created in this way.\n"
"\n"
"If a position next to an existing company is selected, the company would\n"
"expand its operations by one square. This increases the cost of its shares\n"
"and hence your return. Thus, if the map was as shown below, selecting ^k~6^N\n"
"or ^k~8^N increases Company ^B~B^N's shipping lane:\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^o+^e . . ^k~6^e . . ^N\n"
" ^e . ^s*^e . . . . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~6^N or ^k~8^N increases Company ^B~B^N.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . . . ^k~8^e ^N\n"
""),
"Selecting positions next to stars increases the value of your stock by about\n"
"five times as much as an extension not next to a star. Thus move ^k~6^N should\n"
"be preferred to move ^k~8^N.\n"
"\n"
" ^e ^c~C^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e ^k~1^e ^o+^e . ^o+^e . . ^k~6^e . . ^N\n"
" ^e . ^s*^e . . . . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~6^N is preferred to ^k~8^N.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . . . ^k~8^e ^N\n"
"\n"
"You can also expand any company by selecting positions next to outposts.\n"
"Such outposts will be swallowed up by that company. Thus, move ^k~1^N will\n"
"extend Company ^BC^N by ^Btwo^N squares. As a bonus, outposts next to stars are\n"
"more valuable: the company's share price will increase by a greater amount\n"
"than it would for outposts not next to stars.\n"
,
N_(""
"Selecting positions next to stars increases the value of your stock by about\n"
"five times as much as an extension not next to a star. Thus move ^k~6^N should\n"
"be preferred to move ^k~8^N.\n"
"\n"
" ^e ^c~C^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e ^k~1^e ^o+^e . ^o+^e . . ^k~6^e . . ^N\n"
" ^e . ^s*^e . . . . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~6^N is preferred to ^k~8^N.\n"
" ^e . ^k~2^e . . ^k~4^e . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . . . ^k~8^e ^N\n"
"\n"
"You can also expand any company by selecting positions next to outposts.\n"
"Such outposts will be swallowed up by that company. Thus, move ^k~1^N will\n"
"extend Company ^BC^N by ^Btwo^N squares. As a bonus, outposts next to stars are\n"
"more valuable: the company's share price will increase by a greater amount\n"
"than it would for outposts not next to stars.\n"
""),
"If two companies are separated on the map by only one square, then they can\n"
"be ^Bmerged^N into one company by selecting that position (if available). For\n"
"example, on the map below, companies ^B~A^N and ^B~B^N can be merged by selecting ^k~5^N.\n"
"When this occurs, the company with the greater assets value takes over the\n"
"other one. Here, Company ^B~B^N might take over Company ^B~A^N. Company ^B~A^N ceases to\n"
"exist, although it may reappear as an entirely new company at a later stage.\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^c~A^e ^c~A^e ^k~5^e ^c~B^e . . ^N\n"
" ^e . ^s*^e . . ^c~A^e . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~5^N merges companies ^B~A^N and ^B~B^N.\n"
" ^e . ^k~2^e . . . . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . ^o+^e . . ^N\n"
"\n"
"When companies merge, players are granted shares in the dominant company\n"
"proportional to the amount owned in the old company. As well, a cash bonus\n"
"is also paid, proportional to the percentage of the old company owned.\n"
,
N_(""
"If two companies are separated on the map by only one square, then they can\n"
"be ^Bmerged^N into one company by selecting that position (if available). For\n"
"example, on the map below, companies ^B~A^N and ^B~B^N can be merged by selecting ^k~5^N.\n"
"When this occurs, the company with the greater assets value takes over the\n"
"other one. Here, Company ^B~B^N might take over Company ^B~A^N. Company ^B~A^N ceases to\n"
"exist, although it may reappear as an entirely new company at a later stage.\n"
"\n"
" ^e ^k~1^e . ^s*^e . . . ^s*^e ^s*^e . ^N\n"
" ^e . . . ^c~A^e ^c~A^e ^k~5^e ^c~B^e . . ^N\n"
" ^e . ^s*^e . . ^c~A^e . ^c~B^e ^c~B^e ^c~B^e ^N Move ^k~5^N merges companies ^B~A^N and ^B~B^N.\n"
" ^e . ^k~2^e . . . . . ^s*^e ^c~B^e ^N\n"
" ^e . . . . ^s*^e . ^o+^e . . ^N\n"
"\n"
"When companies merge, players are granted shares in the dominant company\n"
"proportional to the amount owned in the old company. As well, a cash bonus\n"
"is also paid, proportional to the percentage of the old company owned.\n"
""),
"Once you select your move, you enter the ^BInterstellar Stock Exchange^N. Here\n"
"you can purchase shares, sell them, borrow from the Trading Bank or repay\n"
"some of your debt (if applicable). Note that each company issues a limited\n"
"number of shares --- you cannot go on buying for ever! You can, however,\n"
"bid for more shares to be issued. You have a better chance of succeeding if\n"
"you own a larger proportion of the company.\n"
"\n"
"The game usually ends after ^B~t^N turns. However, you can end the game sooner\n"
"by pressing ^K<CTRL><C>^N when asked to select a move. As well, individual\n"
"players can declare themselves bankrupt at any time. If your debt is large\n"
"enough, the Bank may do this for you! If you do not complete your game in\n"
"the time you have available, you may save the game and continue it later.\n"
"\n"
"\n"
"The ^Bwinner of the game^N is the person with the greatest net worth (total\n"
"value of cash, stock and debt). ^HGood luck^N and may the best person win!\n"
,
N_(""
"Once you select your move, you enter the ^BInterstellar Stock Exchange^N. Here\n"
"you can purchase shares, sell them, borrow from the Trading Bank or repay\n"
"some of your debt (if applicable). Note that each company issues a limited\n"
"number of shares --- you cannot go on buying for ever! You can, however,\n"
"bid for more shares to be issued. You have a better chance of succeeding if\n"
"you own a larger proportion of the company.\n"
"\n"
"The game usually ends after ^B~t^N turns. However, you can end the game sooner\n"
"by pressing ^K<CTRL><C>^N when asked to select a move. As well, individual\n"
"players can declare themselves bankrupt at any time. If your debt is large\n"
"enough, the Bank may do this for you! If you do not complete your game in\n"
"the time you have available, you may save the game and continue it later.\n"
"\n"
"\n"
"The ^Bwinner of the game^N is the person with the greatest net worth (total\n"
"value of cash, stock and debt). ^HGood luck^N and may the best person win!\n"
""),
NULL
};
@ -178,14 +184,14 @@ void show_help (void)
werase(curwin);
box(curwin, 0, 0);
center(curwin, 1, 0, attr_title, 0, 0, 1, " How to Play ");
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" How to Play "));
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
"Page %d of %d", curpage + 1, numpages);
_("Page %d of %d"), curpage + 1, numpages);
wmove(curwin, 4, 2);
// Process the help text string
const char *s = help_text[curpage];
const char *s = gettext(help_text[curpage]);
int curattr = attr_normal;
while (*s != '\0') {
@ -326,9 +332,9 @@ void show_help (void)
}
center(curwin, getmaxy(curwin) - 2, 0, attr_waitforkey, 0, 0, 1,
(curpage == 0) ? "[ Press <SPACE> to continue ] " :
"[ Press <SPACE> to continue or <BACKSPACE> "
"for the previous page ] ");
(curpage == 0) ? _("[ Press <SPACE> to continue ] ") :
_("[ Press <SPACE> to continue or <BACKSPACE> "
"for the previous page ] "));
wrefresh(curwin);
int key = gettxchar(curwin);

View File

@ -2368,9 +2368,9 @@ bool answer_yesno (WINDOW *win)
wattron(win, A_BOLD);
if (key == 'Y') {
waddstr(win, "Yes");
waddstr(win, _("Yes"));
} else {
waddstr(win, "No");
waddstr(win, _("No"));
}
wbkgdset(win, oldbkgd);

View File

@ -232,17 +232,17 @@ selection_t get_move (void)
box(curwin, 0, 0);
left(curwin, 2, 2, attr_normal, attr_keycode, 0, 1,
"^{<1>^} Display stock portfolio");
_("^{<1>^} Display stock portfolio"));
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
"^{<2>^} Declare bankruptcy");
_("^{<2>^} Declare bankruptcy"));
left(curwin, 2, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<3>^} Save and end the game");
_("^{<3>^} Save and end the game"));
left(curwin, 3, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"^{<CTRL><C>^} Quit the game");
_("^{<CTRL><C>^} Quit the game"));
right(curwin, 1, getmaxx(curwin) / 2, attr_normal, attr_keycode,
attr_choice, 1, "Select move "
"[^[%c^]-^[%c^]/^{1^}-^{3^}/^{<CTRL><C>^}]: ",
attr_choice, 1,
_("Select move [^[%c^]-^[%c^]/^{1^}-^{3^}/^{<CTRL><C>^}]: "),
MOVE_TO_KEY(0), MOVE_TO_KEY(NUMBER_MOVES - 1));
curs_set(CURS_ON);
@ -257,7 +257,7 @@ selection_t get_move (void)
curs_set(CURS_OFF);
left(curwin, 1, getmaxx(curwin) / 2, attr_normal, attr_choice,
0, 1, "Move ^{%c^}", key);
0, 1, _("Move ^{%c^}"), key);
} else {
switch (key) {
case '1':
@ -272,7 +272,7 @@ selection_t get_move (void)
curs_set(CURS_OFF);
left(curwin, 1, getmaxx(curwin) / 2, attr_normal,
attr_normal | A_BOLD, 0, 1,
"^{<2>^} (Declare bankruptcy)");
_("^{<2>^} (Declare bankruptcy)"));
break;
case '3':
@ -281,7 +281,7 @@ selection_t get_move (void)
curs_set(CURS_OFF);
left(curwin, 1, getmaxx(curwin) / 2, attr_normal,
attr_normal | A_BOLD, 0, 1,
"^{<3>^} (Save and end the game)");
_("^{<3>^} (Save and end the game)"));
break;
case KEY_ESC:
@ -295,7 +295,7 @@ selection_t get_move (void)
curs_set(CURS_OFF);
left(curwin, 1, getmaxx(curwin) / 2, attr_normal,
attr_normal | A_BOLD, 0, 1,
"^{<CTRL><C>^} (Quit the game)");
_("^{<CTRL><C>^} (Quit the game)"));
break;
default:
@ -310,7 +310,7 @@ selection_t get_move (void)
// Ask the player to confirm their choice
right(curwin, 2, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
"Are you sure? [^{Y^}/^{N^}] ");
_("Are you sure? [^{Y^}/^{N^}] "));
wrefresh(curwin);
if (! answer_yesno(curwin)) {
@ -327,7 +327,7 @@ selection_t get_move (void)
if (game_loaded) {
// Save the game to the same game number
mkchstr(chbuf, BUFSIZE, attr_status_window, 0, 0, 1, WIN_COLS
- 7, &width, 1, "Saving game %d... ", game_num);
- 7, &width, 1, _("Saving game %d... "), game_num);
newtxwin(5, width + 5, 7, WCENTER, true, attr_status_window);
centerch(curwin, 2, 0, chbuf, 1, &width);
wrefresh(curwin);
@ -348,8 +348,8 @@ selection_t get_move (void)
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_keycode, 0,
2, WIN_COLS - 7, widthbuf, 2,
"Enter game number [^{1^}-^{9^}] "
"or ^{<CTRL><C>^} to cancel: ");
_("Enter game number [^{1^}-^{9^}] "
"or ^{<CTRL><C>^} to cancel: "));
assert(lines == 1 || lines == 2);
maxwidth = ((lines == 1) ? widthbuf[0] :
MAX(widthbuf[0], widthbuf[1])) + 5;
@ -394,8 +394,9 @@ selection_t get_move (void)
mkchstr(chbuf, BUFSIZE, attr_status_window, 0, 0, 1,
WIN_COLS - 7, &width, 1,
"Saving game %d... ", game_num);
newtxwin(5, width + 5, 7, WCENTER, true, attr_status_window);
_("Saving game %d... "), game_num);
newtxwin(5, width + 5, 7, WCENTER, true,
attr_status_window);
centerch(curwin, 2, 0, chbuf, 1, &width);
wrefresh(curwin);
@ -623,14 +624,16 @@ void bankrupt_player (bool forced)
if (forced) {
txdlgbox(MAX_DLG_LINES, 50, 7, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Bankruptcy Court ",
"%s has been declared bankrupt by the Interstellar Trading Bank.",
attr_error_waitforkey, _(" Bankruptcy Court "),
_("%s has been declared bankrupt "
"by the Interstellar Trading Bank."),
player[current_player].name);
} else {
txdlgbox(MAX_DLG_LINES, 50, 7, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, " Bankruptcy Court ",
"%s has declared bankruptcy.", player[current_player].name);
attr_error_waitforkey, _(" Bankruptcy Court "),
_("%s has declared bankruptcy."),
player[current_player].name);
}
txrefresh();
@ -697,8 +700,9 @@ void try_start_new_company (int x, int y)
txdlgbox(MAX_DLG_LINES, 50, 7, WCENTER, attr_normal_window,
attr_title, attr_normal, attr_highlight, 0, attr_waitforkey,
" New Company ", "A new company has been formed!\n"
"Its name is ^{%s^}.", company[i].name);
_(" New Company "),
_("A new company has been formed!\nIts name is ^{%s^}."),
company[i].name);
txrefresh();
galaxy_map[x][y] = COMPANY_TO_MAP(i);
@ -751,14 +755,15 @@ void merge_companies (map_val_t a, map_val_t b)
// Display information about the merger
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_highlight, 0, 4, WIN_COLS
- 8, widthbuf, 4, "^{%s^} has just merged into ^{%s^}.\n"
"Please note the following transactions:\n",
lines = mkchstr(chbuf, BUFSIZE, attr_normal, attr_highlight, 0, 4,
WIN_COLS - 8, widthbuf, 4,
_("^{%s^} has just merged into ^{%s^}.\n"
"Please note the following transactions:\n"),
company[bb].name, company[aa].name);
newtxwin(number_players + lines + 10, WIN_COLS - 4, lines + 6
- number_players, WCENTER, true, attr_normal_window);
center(curwin, 1, 0, attr_title, 0, 0, 1, " Company Merger ");
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" Company Merger "));
centerch(curwin, 3, 0, chbuf, lines, widthbuf);
mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, getmaxx(curwin) / 2,
@ -770,7 +775,7 @@ void merge_companies (map_val_t a, map_val_t b)
chbuf_bb = chstrdup(chbuf, BUFSIZE);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) / 2, &width,
1, "Old stock: ");
1, _("Old stock: "));
w = getmaxx(curwin);
x = (w + width - MAX(width_aa, width_bb)) / 2;
@ -778,19 +783,19 @@ void merge_companies (map_val_t a, map_val_t b)
rightch(curwin, lines + 3, x, chbuf, 1, &width);
leftch(curwin, lines + 3, x, chbuf_bb, 1, &width_bb);
right(curwin, lines + 4, x, attr_normal, 0, 0, 1, "New Stock: ");
right(curwin, lines + 4, x, attr_normal, 0, 0, 1, _("New Stock: "));
leftch(curwin, lines + 4, x, chbuf_aa, 1, &width_aa);
mvwhline(curwin, lines + 6, 2, ' ' | attr_subtitle, w - 4);
left(curwin, lines + 6, 4, attr_subtitle, 0, 0, 1, "Player");
left(curwin, lines + 6, 4, attr_subtitle, 0, 0, 1, _("Player"));
right(curwin, lines + 6, w - 4, attr_subtitle, 0, 0, 1,
"Bonus (%s)", lconvinfo.currency_symbol);
_("Bonus (%s)"), lconvinfo.currency_symbol);
right(curwin, lines + 6, w - 6 - MERGE_BONUS_COLS, attr_subtitle, 0, 0,
1, "Total");
1, _("Total"));
right(curwin, lines + 6, w - 8 - MERGE_BONUS_COLS - MERGE_TOTAL_STOCK_COLS,
attr_subtitle, 0, 0, 1, "New");
attr_subtitle, 0, 0, 1, _("New"));
right(curwin, lines + 6, w - 10 - MERGE_BONUS_COLS - MERGE_TOTAL_STOCK_COLS
- MERGE_NEW_STOCK_COLS, attr_subtitle, 0, 0, 1, "Old");
- MERGE_NEW_STOCK_COLS, attr_subtitle, 0, 0, 1, _("Old"));
total_new = 0;
for (ln = lines + 7, i = 0; i < number_players; i++) {
@ -936,11 +941,11 @@ void adjust_values (void)
txdlgbox(MAX_DLG_LINES, 60, 6, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight,
attr_error_normal, 0, attr_error_waitforkey,
" Bankruptcy Court ",
"%s has been declared bankrupt "
"by the Interstellar Trading Bank.\n\n"
"^{All assets have been taken "
"to repay outstanding loans.^}",
_(" Bankruptcy Court "),
_("%s has been declared bankrupt "
"by the Interstellar Trading Bank.\n\n"
"^{All assets have been taken "
"to repay outstanding loans.^}"),
company[which].name);
txrefresh();
@ -959,17 +964,18 @@ void adjust_values (void)
lines = mkchstr(chbuf, BUFSIZE, attr_error_highlight,
attr_error_normal, 0, 6, 60 - 4, widthbuf, 6,
"%s has been declared bankrupt by the "
"Interstellar Trading Bank.\n\n"
"^{The Bank has agreed to pay stock holders ^}"
"%.2f%%^{ of the share value on each share "
"owned.^}", company[which].name, rate * 100.0);
_("%s has been declared bankrupt by the "
"Interstellar Trading Bank.\n\n"
"^{The Bank has agreed to pay stock holders ^}"
"%.2f%%^{ of the share value on each share "
"owned.^}"),
company[which].name, rate * 100.0);
newtxwin(9 + lines, 60, 4, WCENTER, true, attr_error_window);
w = getmaxx(curwin);
center(curwin, 1, 0, attr_error_title, 0, 0, 1,
" Bankruptcy Court ");
_(" Bankruptcy Court "));
centerch(curwin, 3, 0, chbuf, lines, widthbuf);
mkchstr(chbuf, BUFSIZE, attr_error_highlight, 0, 0, 1, w / 2,
@ -977,11 +983,11 @@ void adjust_values (void)
chbuf_amt = chstrdup(chbuf, BUFSIZE);
mkchstr(chbuf, BUFSIZE, attr_error_normal, 0, 0, 1, w / 2,
&width, 1, "Amount paid per share: ");
&width, 1, _("Amount paid per share: "));
x = (w + width - width_amt) / 2;
right(curwin, lines + 4, x, attr_error_normal, 0, 0, 1,
"Old share value: ");
_("Old share value: "));
leftch(curwin, lines + 4, x, chbuf_amt, 1, &width_amt);
rightch(curwin, lines + 5, x, chbuf, 1, &width);
@ -1073,9 +1079,9 @@ void adjust_values (void)
txdlgbox(MAX_DLG_LINES, 60, 7, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, attr_error_normal,
0, attr_error_waitforkey, " Interstellar Trading Bank ",
"Your debt has amounted to %N!\n"
"^{The Bank has impounded ^}%N^{ from your cash.^}",
0, attr_error_waitforkey, _(" Interstellar Trading Bank "),
_("Your debt has amounted to %N!\n"
"^{The Bank has impounded ^}%N^{ from your cash.^}"),
player[current_player].debt, impounded);
txrefresh();