1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-07-21 16:14:14 -04:00

Add many comments for translators; use pgettext() where appropriate

This commit is contained in:
John Zaitseff 2011-08-17 19:13:05 +10:00
parent 25d586f775
commit b674c05d56
6 changed files with 218 additions and 49 deletions

View File

@ -114,15 +114,41 @@ void exchange_stock (void)
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"));
right(curwin, 4, w - 6 - STOCK_LEFT_COLS, attr_subtitle, 0, 0,
2, _("Shares\nissued"));
left(curwin, 4, 4, attr_subtitle, 0, 0, 2,
/* TRANSLATORS: "Company" is a two-line column label in
a table containing a list of companies. */
pgettext("subtitle", "\nCompany"));
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2,
/* TRANSLATORS: "Shares left" is a two-line column
label in a table containing the number of shares
left to be purchased in any given company. The
maximum column width is 10 characters (see
STOCK_LEFT_COLS in src/intf.h). */
pgettext("subtitle", "Shares\nleft"));
right(curwin, 4, w - 6 - STOCK_LEFT_COLS, attr_subtitle, 0, 0, 2,
/* TRANSLATORS: "Shares issued" is a two-line column
label in a table containing the number of shares
already sold (ie, bought by all players) in any
given company. The maximum column width is 10
characters (see STOCK_ISSUED_COLS in src/intf.h). */
pgettext("subtitle", "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,
/* TRANSLATORS: "Return" is a two-line column label in
a table containing the share return as a percentage
in any given company. The maximum column width is
10 characters (see SHARE_RETURN_COLS in src/intf.h). */
pgettext("subtitle", "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);
/* TRANSLATORS: "Price per share" is a two-line column
label in a table containing the price per share in
any given company. %s is the currency symbol in the
current locale. The maximum column width is 12
characters INCLUDING the currency symbol (see
SHARE_PRICE_COLS in src/intf.h). */
pgettext("subtitle", "Price per\nshare (%s)"),
lconvinfo.currency_symbol);
for (line = 6, i = 0; i < MAX_COMPANIES; i++) {
if (company[i].on_map) {
@ -267,22 +293,34 @@ void visit_bank (void)
_(" Interstellar Trading Bank "));
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) - 4, &width,
1, _("Current cash: "));
1, pgettext("label", "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,
pgettext("label", "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,
pgettext("label", "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,
/* TRANSLATORS: The "Total value", "Current cash", "Current
debt", "Interest rate" and "Credit limit" labels MUST all be
the same length (ie, right-padded with spaces as needed) and
must have at least one trailing space so that the display
routines work correctly. The maximum length of each label
is 36 characters.
Note that some of these labels are used for both the Player
Status window and the Trading Bank window. */
pgettext("label", "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);
@ -293,6 +331,10 @@ 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,
/* TRANSLATORS: The "Borrow money", "Repay debt" and "Exit
from the Bank" menu options must all be the same length
(ie, padded with trailing spaces as required). The maximum
length is 72 characters. */
_("^{<1>^} Borrow money "));
center(curwin, 4, 0, attr_normal, attr_keycode, 0, 1,
_("^{<2>^} Repay debt "));
@ -491,36 +533,66 @@ 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 "),
company[num].name);
center(curwin, 1, 0, attr_title, 0, 0, 1,
/* TRANSLATORS: %s represents the company name. */
_(" Stock Transaction in %s "), company[num].name);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, w / 2, &width, 1,
_("Shares issued: "));
/* TRANSLATORS: "Shares issued" represents the number of
shares already sold by the company to all players.
Note that the labels "Shares issued", "Shares left",
"Price per share" and "Return" must all be the same length
and must have at least one trailing space for the output
routines to work correctly. The maximum length of each
label is 22 characters. */
pgettext("label|Stock A", "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,
/* TRANSLATORS: "Shares left" is the number of shares that are
left to be purchased in the current company. */
pgettext("label|Stock A", "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,
/* TRANSLATORS: "Price per share" is the cost of each share in
the current company. */
pgettext("label|Stock A", "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,
/* TRANSLATORS: "Return" is the share return as a percentage. */
pgettext("label|Stock A", "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,
/* TRANSLATORS: "Current holdings" is the number of shares the
current player owns in this particular company.
Note that the labels "Current holdings", "Percentage owned"
and "Current cash" MUST all be the same length and contain at
least one trailing space for the display routines to work
correctly. The maximum length of each label is 18
characters. */
pgettext("label|Stock B", "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,
/* TRANSLATORS: "Percentage owned" is the current player's
percentage ownership in this particular company. */
pgettext("label|Stock B", "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,
pgettext("label|Stock B", "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);
@ -669,12 +741,14 @@ void trade_shares (int num, bool *bid_used)
txdlgbox(MAX_DLG_LINES, 50, 8, WCENTER, attr_error_window,
attr_error_title, attr_error_highlight, 0, 0,
attr_error_waitforkey, _(" No Shares Issued "),
/* TRANSLATORS: %s represents the company name. */
_("%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 "),
/* TRANSLATORS: %s represents the company name. */
ngettext("%s has issued\n^{one^} more share.",
"%s has issued\n^{%'ld^} more shares.",
maxshares), company[num].name, maxshares);

View File

@ -410,6 +410,7 @@ void ask_player_names (void)
player[i].name = NULL;
entered[i] = false;
left(curwin, i + 3, 2, attr_normal, 0, 0, 1,
/* xgettext:c-format, range: 1..8 */
_("Player %d: "), i + 1);
}
@ -564,9 +565,15 @@ void end_game (void)
mvwhline(curwin, lines + 4, 2, ' ' | attr_subtitle, w - 4);
left(curwin, lines + 4, ORDINAL_COLS + 4, attr_subtitle, 0, 0, 1,
_("Player"));
/* TRANSLATORS: "Player" is used as a column title in a
table containing all player names. */
pgettext("subtitle", "Player"));
right(curwin, lines + 4, w - 4, attr_subtitle, 0, 0, 1,
_("Total Value (%s)"), lconvinfo.currency_symbol);
/* TRANSLATORS: "Total Value" refers to the total worth
(shares, cash and debt) of any given player. %s is the
currency symbol of the current locale. */
pgettext("subtitle", "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,
@ -599,8 +606,8 @@ void show_map (bool closewin)
mvwhline(curwin, 1, 2, ' ' | attr_mapwin_title, getmaxx(curwin) - 4);
// Display current player and turn number
left(curwin, 1, 2, attr_mapwin_title, attr_mapwin_highlight, 0, 1,
_(" Player: ^{%s^} "), player[current_player].name);
left(curwin, 1, 4, attr_mapwin_title, attr_mapwin_highlight, 0, 1,
_("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^} ") :
@ -691,16 +698,40 @@ void show_status (int num)
mvwhline(curwin, 5, 2, ' ' | attr_subtitle, w - 4);
left(curwin, 4, 4, attr_subtitle, 0, 0, 2,
_("\nCompany"));
/* TRANSLATORS: "Company" is a two-line column label in
a table containing a list of companies. */
pgettext("subtitle", "\nCompany"));
right(curwin, 4, w - 4, attr_subtitle, 0, 0, 2,
_("Ownership\n(%%)"));
/* TRANSLATORS: "Ownership" is a two-line column label
in a table containing the current player's
percentage ownership in any given company. The
maximum column width is 10 characters (see
OWNERSHIP_COLS in src/intf.h). */
pgettext("subtitle", "Ownership\n(%%)"));
right(curwin, 4, w - 6 - OWNERSHIP_COLS, attr_subtitle, 0, 0, 2,
_("Holdings\n(shares)"));
/* TRANSLATORS: "Holdings" is a two-line column label
in a table containing the number of shares the
current player owns in any given company. The
maximum column width is 10 characters (see
STOCK_OWNED_COLS in src/intf.h). */
pgettext("subtitle", "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,
/* TRANSLATORS: "Return" is a two-line column label in
a table containing the share return as a percentage
in any given company. The maximum column width is
10 characters (see SHARE_RETURN_COLS in src/intf.h). */
pgettext("subtitle", "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);
/* TRANSLATORS: "Price per share" is a two-line column
label in a table containing the price per share in
any given company. %s is the currency symbol in the
current locale. The maximum column width is 12
characters INCLUDING the currency symbol (see
SHARE_PRICE_COLS in src/intf.h). */
pgettext("subtitle", "Price per\nshare (%s)"),
lconvinfo.currency_symbol);
for (line = 6, i = 0; i < MAX_COMPANIES; i++) {
if (company[i].on_map) {
@ -731,24 +762,33 @@ void show_status (int num)
int width, x;
mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, w / 2, &width, 1,
_("Total value: "));
/* TRANSLATORS: The "Total value", "Current cash",
"Current debt" and "Interest rate" labels MUST all be
the same length (ie, right-padded with spaces as
needed) and must have at least one trailing space so
that the display routines work correctly. The maximum
length of each label is 36 characters.
Note that some of these labels are used for both the
Player Status window and the Trading Bank window. */
pgettext("label", "Total value: "));
x = (w + width - (TOTAL_VALUE_COLS + 2)) / 2;
right(curwin, line, x, attr_normal, attr_highlight, 0, 1,
_("Current cash: "));
pgettext("label", "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: "));
pgettext("label", "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: "));
pgettext("label", "Interest rate: "));
right(curwin, line, x + TOTAL_VALUE_COLS + 2, attr_normal,
attr_highlight, 0, 1, " ^{%.2f%%^} ", interest_rate * 100.0);
line++;

View File

@ -41,7 +41,8 @@ const char *company_name[MAX_COMPANIES] = {
/* TRANSLATORS: The eight company names do NOT have to be literal
translations of the English names. In fact, if possible, the
names should start with successive letters of your alphabet (in
English, "A" to "H"). */
English, "A" to "H"). No company name should be more than 24
characters (column positions, to be precise) long. */
N_("Altair Starways"),
N_("Betelgeuse, Ltd"),
N_("Capella Freight Co"),

View File

@ -2368,9 +2368,12 @@ bool answer_yesno (WINDOW *win)
wattron(win, A_BOLD);
if (key == 'Y') {
waddstr(win, _("Yes"));
/* TRANSLATORS: The strings "Yes" and "No" are printed as a
response to user input in answer to questions like "Are you
sure? [Y/N] " */
waddstr(win, pgettext("answer", "Yes"));
} else {
waddstr(win, _("No"));
waddstr(win, pgettext("answer", "No"));
}
wbkgdset(win, oldbkgd);

View File

@ -257,7 +257,11 @@ 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,
/* TRANSLATORS: "Move" refers to the choice of moves
made by the current player (out of a selection of
20 moves). */
_("Move ^{%c^}"), key);
} else {
switch (key) {
case '1':
@ -774,8 +778,16 @@ void merge_companies (map_val_t a, map_val_t b)
&width_bb, 1, "%s", company[bb].name);
chbuf_bb = chstrdup(chbuf, BUFSIZE);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) / 2, &width,
1, _("Old stock: "));
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) / 2,
&width, 1,
/* TRANSLATORS: "Old stock" refers to the company that has
just ceased existence due to a merger.
Note that the "Old stock" and "New stock" labels MUST be
the same length and must contain a trailing space for the
display routines to work correctly. The maximum length of
each label is 36 characters. */
pgettext("label", "Old stock: "));
w = getmaxx(curwin);
x = (w + width - MAX(width_aa, width_bb)) / 2;
@ -783,19 +795,43 @@ 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,
/* TRANSLATORS: "New stock" refers to the company that has
absorbed another due to a merger. */
pgettext("label", "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,
/* TRANSLATORS: "Player" is used as a column title in a
table containing all player names. */
pgettext("subtitle", "Player"));
right(curwin, lines + 6, w - 4, attr_subtitle, 0, 0, 1,
_("Bonus (%s)"), lconvinfo.currency_symbol);
right(curwin, lines + 6, w - 6 - MERGE_BONUS_COLS, attr_subtitle, 0, 0,
1, _("Total"));
/* TRANSLATORS: "Bonus" refers to the bonus cash amount paid to
each player after two companies merge. %s is the currency
symbol in the current locale. The maximum column width is
12 characters INCLUDING the currency symbol (see
MERGE_BONUS_COLS in src/intf.h). */
pgettext("subtitle", "Bonus (%s)"),
lconvinfo.currency_symbol);
right(curwin, lines + 6, w - 6 - MERGE_BONUS_COLS, attr_subtitle, 0, 0, 1,
/* TRANSLATORS: "Total" refers to the total number of shares in
the new company after a merger. The maximum column width is
8 characters (see MERGE_TOTAL_STOCK_COLS in src/intf.h). */
pgettext("subtitle", "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,
/* TRANSLATORS: "New" refers to how many (new) shares each
player receives in the surviving company after a merger.
The maximum column width is 8 characters (see
MERGE_NEW_STOCK_COLS in src/intf.h). */
pgettext("subtitle", "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,
/* TRANSLATORS: "Old" refers to how many shares each player had
in the company ceasing existence. The maximum column width
is 8 characters (see MERGE_OLD_STOCK_COLS in src/intf.h). */
pgettext("subtitle", "Old"));
total_new = 0;
for (ln = lines + 7, i = 0; i < number_players; i++) {
@ -983,11 +1019,24 @@ 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,
/* TRANSLATORS: The label "Amount paid per share"
refers to payment made by the Interstellar
Trading Bank to each player upon company
bankruptcy. This label MUST be the same
length as "Old share value" and MUST have at
least one trailing space for the display
routines to work correctly. The maximum
length is 28 characters. */
pgettext("label", "Amount paid per share: "));
x = (w + width - width_amt) / 2;
right(curwin, lines + 4, x, attr_error_normal, 0, 0, 1,
_("Old share value: "));
/* TRANSLATORS: "Old share value" refers to the
share price of a company before it was forced
into bankruptcy by the Bank. This label must be
the same width as "Amount paid per share". */
pgettext("label", "Old share value: "));
leftch(curwin, lines + 4, x, chbuf_amt, 1, &width_amt);
rightch(curwin, lines + 5, x, chbuf, 1, &width);

View File

@ -336,14 +336,16 @@ playing that game. If GAME is not specified, start a new game.\n\n\
address or web URL for reporting bugs in your translation. */
printf(_("Report bugs to %s <%s>.\n"), PACKAGE_AUTHOR, PACKAGE_BUGREPORT);
#else
/* TRANSLATORS: The %s is the e-mail address for reporting bugs.
As with the previous string, please add ANOTHER line with the
/* TRANSLATORS: %s is the e-mail address for reporting bugs. As
with the previous string, please add ANOTHER line with the
(translated) text "Report translation bugs to <ADDRESS>\n",
with ADDRESS replaced with either an e-mail address or web URL
for reporting bugs in your translation. */
printf(_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
#endif
#ifdef PACKAGE_PACKAGER_BUG_REPORTS
/* TRANSLATORS: The first %s is for packagers and may be
something like "Debian". */
printf(_("Report %s bugs to <%s>.\n"), PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS);
#endif
#ifdef PACKAGE_URL