nls: improve translations and provide translator help comments

Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-12-17 18:32:47 +01:00
parent 7b6084451d
commit 0022b6ec5d
15 changed files with 153 additions and 49 deletions

7
free.c
View File

@ -271,9 +271,10 @@ int main(int argc, char **argv)
do { do {
meminfo(); meminfo();
printf("%7s %10s %10s %10s %10s %10s %10s\n", /* Translation Hint: You can use 9 character words in
"", _("total"), _("used"), _("free"), _("shared"), * the header, and the words need to be right align to
_("buffers"), _("cached")); * beginning of a number. */
printf("%s\n", _(" total used free shared buffers cached"));
printf("%-7s", _("Mem:")); printf("%-7s", _("Mem:"));
printf(" %10s", scale_size(kb_main_total, flags, args)); printf(" %10s", scale_size(kb_main_total, flags, args));
printf(" %10s", scale_size(kb_main_used, flags, args)); printf(" %10s", scale_size(kb_main_used, flags, args));

View File

@ -750,7 +750,7 @@ static void parse_opts (int argc, char **argv)
else if (argc - optind > 1) else if (argc - optind > 1)
usage (0); usage (0);
else if (criteria_count == 0) { else if (criteria_count == 0) {
warnx(_("No matching criteria specified")); warnx(_("no matching criteria specified"));
usage (0); usage (0);
} }
} }

11
pmap.c
View File

@ -108,11 +108,11 @@ static void discover_shm_minor(void)
} }
if (shmdt(addr)) if (shmdt(addr))
perror(_("shmdt")); perror(_("shared memory detach"));
out_destroy: out_destroy:
if (shmctl(shmid, IPC_RMID, NULL)) if (shmctl(shmid, IPC_RMID, NULL))
perror(_("IPC_RMID")); perror(_("shared memory remove"));
return; return;
} }
@ -190,6 +190,9 @@ static int one_proc(proc_t * p)
if (!q_option && (x_option | d_option)) { if (!q_option && (x_option | d_option)) {
if (x_option) { if (x_option) {
if (sizeof(KLONG) == 4) if (sizeof(KLONG) == 4)
/* Translation Hint: Please keep
* alignment of the following four
* headers intact. */
printf printf
(_("Address Kbytes RSS Dirty Mode Mapping\n")); (_("Address Kbytes RSS Dirty Mode Mapping\n"));
else else
@ -353,10 +356,14 @@ static int one_proc(proc_t * p)
} }
if (!x_option && !d_option) { if (!x_option && !d_option) {
if (sizeof(KLONG) == 8) if (sizeof(KLONG) == 8)
/* Translation Hint: keep total string length
* as 24 characters. Adjust %16 if needed*/
printf(_(" total %16ldK\n"), printf(_(" total %16ldK\n"),
(total_shared + total_private_writeable + (total_shared + total_private_writeable +
total_private_readonly) >> 10); total_private_readonly) >> 10);
else else
/* Translation Hint: keep total string length
* as 16 characters. Adjust %8 if needed*/
printf(_(" total %8ldK\n"), printf(_(" total %8ldK\n"),
(total_shared + total_private_writeable + (total_shared + total_private_writeable +
total_private_readonly) >> 10); total_private_readonly) >> 10);

View File

@ -496,5 +496,5 @@ void self_info(void){
fprintf(stderr, _("archdefs:%s\n"), archdefs); fprintf(stderr, _("archdefs:%s\n"), archdefs);
open_psdb(namelist_file); open_psdb(namelist_file);
fprintf(stderr,_("namelist_file=\"%s\"\n"),namelist_file?namelist_file:"<no System.map file>"); fprintf(stderr,_("namelist_file=\"%s\"\n"),namelist_file?namelist_file:_("<no System.map file>"));
} }

View File

@ -19,7 +19,7 @@ void __attribute__ ((__noreturn__)) usage(FILE * out, int section)
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options]\n", program_invocation_short_name); _(" %s [options]\n"), program_invocation_short_name);
if (section == USAGE_SELECTION || section == USAGE_ALL) { if (section == USAGE_SELECTION || section == USAGE_ALL) {
fputs(_("\nSimple options:\n"), out); fputs(_("\nSimple options:\n"), out);
fputs(_(" -A all processes\n"), out); fputs(_(" -A all processes\n"), out);
@ -95,9 +95,16 @@ void __attribute__ ((__noreturn__)) usage(FILE * out, int section)
fputs(_(" display help\n"), out); fputs(_(" display help\n"), out);
} }
if (section == USAGE_DEFAULT) if (section == USAGE_DEFAULT)
fprintf(out,
_("\n Try `%s --help <selection|list|output|threads|misc|all>'\n" /* Translation Hint: do not translate arguments, that breaks
" for more information.\n"), program_invocation_short_name); * string comparison. Outputting something like following
* might work.
*
* Zry `%s --help <selection|list|output|threads|misc|all>
* (zlekzio|lizt|czreen vrites|threadz|mizc|trezt)
*/
fprintf(out, _("\n Try `%s --help <selection|list|output|threads|misc|all>'\n"
" for more information.\n"), program_invocation_short_name);
fprintf(out, USAGE_MAN_TAIL("ps(1)")); fprintf(out, USAGE_MAN_TAIL("ps(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
} }

View File

@ -1134,7 +1134,7 @@ static const char *parse_all_options(void){
return _("Garbage option."); return _("Garbage option.");
break; break;
default: default:
printf(_(" ? %s\n"),ps_argv[thisarg]); printf(" ? %s\n",ps_argv[thisarg]);
return _("Something broke."); return _("Something broke.");
} /* switch */ } /* switch */
if(err) return err; if(err) return err;

View File

@ -96,12 +96,12 @@ static void O_wrap(sf_node *sfn, int otype){
trailer = (otype=='b') ? "END_BSD" : "END_SYS5" ; trailer = (otype=='b') ? "END_BSD" : "END_SYS5" ;
fnode = do_one_spec("pid",NULL); fnode = do_one_spec("pid",NULL);
if(!fnode)fprintf(stderr,"Seriously crashing. Goodbye cruel world.\n"); if(!fnode)fprintf(stderr,_("Seriously crashing. Goodbye cruel world.\n"));
endp = sfn->f_cooked; while(endp->next) endp = endp->next; /* find end */ endp = sfn->f_cooked; while(endp->next) endp = endp->next; /* find end */
endp->next = fnode; endp->next = fnode;
fnode = do_one_spec(trailer,NULL); fnode = do_one_spec(trailer,NULL);
if(!fnode) { fprintf(stderr,"Seriously crashing. Goodbye cruel world.\n"); exit(1); } if(!fnode) { fprintf(stderr,_("Seriously crashing. Goodbye cruel world.\n")); exit(1); }
endp = fnode; while(endp->next) endp = endp->next; /* find end */ endp = fnode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->f_cooked; endp->next = sfn->f_cooked;
sfn->f_cooked = fnode; sfn->f_cooked = fnode;
@ -792,7 +792,7 @@ const char *process_sf_options(int localbroken){
// with sorting. Do the threads remain grouped, with sorting // with sorting. Do the threads remain grouped, with sorting
// by process, or do the threads get sorted by themselves? // by process, or do the threads get sorted by themselves?
if(sort_list && (thread_flags&TF_no_sort)){ if(sort_list && (thread_flags&TF_no_sort)){
return _("Tell procps@freelists.org what you expected."); return _("Tell PACKAGE_BUGREPORT what you expected.");
} }
// If nothing else, try to use $PS_FORMAT before the default. // If nothing else, try to use $PS_FORMAT before the default.
@ -802,7 +802,7 @@ const char *process_sf_options(int localbroken){
if(tmp && *tmp){ if(tmp && *tmp){
const char *err; const char *err;
sf_node sfn; sf_node sfn;
if(thread_flags&TF_must_use) return _("Tell procps@freelists.org what you want. (-L/-T, -m/m/H, and $PS_FORMAT)"); if(thread_flags&TF_must_use) return _("Tell PACKAGE_BUGREPORT what you want. (-L/-T, -m/m/H, and $PS_FORMAT)");
sfn.sf = tmp; sfn.sf = tmp;
sfn.f_cooked = NULL; sfn.f_cooked = NULL;
err = format_parse(&sfn); err = format_parse(&sfn);

2
pwdx.c
View File

@ -26,7 +26,7 @@
static void __attribute__ ((__noreturn__)) usage(FILE * out) static void __attribute__ ((__noreturn__)) usage(FILE * out)
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, " %s [options] pid...\n", program_invocation_short_name); fprintf(out, _(" %s [options] pid...\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(USAGE_HELP, out); fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out); fputs(USAGE_VERSION, out);

View File

@ -187,6 +187,8 @@ static void show_lists(void)
{ {
int i; int i;
/* Translation Hint: the following few messages to "CMD" are
* for debugging, and does not have to be translated. */
fprintf(stderr, _("signal: %d\n"), sig_or_pri); fprintf(stderr, _("signal: %d\n"), sig_or_pri);
fprintf(stderr, _("%d TTY: "), tty_count); fprintf(stderr, _("%d TTY: "), tty_count);
@ -261,7 +263,7 @@ static void __attribute__ ((__noreturn__)) kill_usage(FILE * out)
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options] <pid> [...]\n", program_invocation_short_name); _(" %s [options] <pid> [...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" <pid> [...] send signal to every <pid> listed\n"), out); fputs(_(" <pid> [...] send signal to every <pid> listed\n"), out);
fputs(_(" -<signal>, -s, --signal <signal>\n"), out); fputs(_(" -<signal>, -s, --signal <signal>\n"), out);
@ -282,11 +284,11 @@ static void __attribute__ ((__noreturn__)) skillsnice_usage(FILE * out)
if (program == PROG_SKILL) { if (program == PROG_SKILL) {
fprintf(out, fprintf(out,
" %s [signal] [options] <expression>\n", _(" %s [signal] [options] <expression>\n"),
program_invocation_short_name); program_invocation_short_name);
} else { } else {
fprintf(out, fprintf(out,
" %s [new priority] [options] <expression>\n", _(" %s [new priority] [options] <expression>\n"),
program_invocation_short_name); program_invocation_short_name);
} }
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);

View File

@ -172,7 +172,7 @@ static void sigint_handler(int unused __attribute__ ((__unused__)))
static void __attribute__((__noreturn__)) usage(FILE *out) static void __attribute__((__noreturn__)) usage(FILE *out)
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, " %s [options]\n", program_invocation_short_name); fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fprintf(out, _(" -d, --delay <secs> delay updates\n")); fprintf(out, _(" -d, --delay <secs> delay updates\n"));
fprintf(out, _(" -o, --once only display once, then exit\n")); fprintf(out, _(" -o, --once only display once, then exit\n"));
@ -325,7 +325,7 @@ int main(int argc, char *argv[])
} }
if (tcgetattr(STDIN_FILENO, &saved_tty) == -1) if (tcgetattr(STDIN_FILENO, &saved_tty) == -1)
warn(_("tcgetattr")); warn(_("terminal setting retrieval"));
old_rows = rows; old_rows = rows;
term_size(0); term_size(0);
@ -359,6 +359,8 @@ int main(int argc, char *argv[])
" %-35s: %d / %d (%.1f%%)\n" " %-35s: %d / %d (%.1f%%)\n"
" %-35s: %.2fK / %.2fK (%.1f%%)\n" " %-35s: %.2fK / %.2fK (%.1f%%)\n"
" %-35s: %.2fK / %.2fK / %.2fK\n\n", " %-35s: %.2fK / %.2fK / %.2fK\n\n",
/* Translation Hint: Next five strings must not
* exceed 35 length in characters. */
_("Active / Total Objects (% used)"), _("Active / Total Objects (% used)"),
stats.nr_active_objs, stats.nr_objs, stats.nr_active_objs, stats.nr_objs,
100.0 * stats.nr_active_objs / stats.nr_objs, 100.0 * stats.nr_active_objs / stats.nr_objs,
@ -378,10 +380,9 @@ int main(int argc, char *argv[])
slab_list = slabsort(slab_list); slab_list = slabsort(slab_list);
attron(A_REVERSE); attron(A_REVERSE);
print_line("%6s %6s %4s %8s %6s %8s %10s %-23s\n", /* Translation Hint: Please keep alignment of the
_("OBJS"), _("ACTIVE"), _("USE"), _("OBJ SIZE"), * following intact. */
_("SLABS"), _("OBJ/SLAB"), _("CACHE SIZE"), printw("%-78s\n", _(" OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME"));
_("NAME"));
attroff(A_REVERSE); attroff(A_REVERSE);
curr = slab_list; curr = slab_list;

View File

@ -90,7 +90,7 @@ static void __attribute__ ((__noreturn__))
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options] [variable[=value] ...]\n", program_invocation_short_name); _(" %s [options] [variable[=value] ...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --all display all variables\n"), out); fputs(_(" -a, --all display all variables\n"), out);
fputs(_(" -A alias of -a\n"), out); fputs(_(" -A alias of -a\n"), out);

View File

@ -68,7 +68,8 @@ static void setsize(int i)
static void __attribute__ ((__noreturn__)) usage(FILE * out) static void __attribute__ ((__noreturn__)) usage(FILE * out)
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, " %s [options] [tty]\n", program_invocation_short_name); fprintf(out,
_(" %s [options] [tty]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" -d, --delay <secs> update delay in seconds\n"), out); fputs(_(" -d, --delay <secs> update delay in seconds\n"), out);
fputs(_(" -s, --scale <num> vertical scale\n"), out); fputs(_(" -s, --scale <num> vertical scale\n"), out);

113
vmstat.c
View File

@ -66,7 +66,7 @@ static void __attribute__ ((__noreturn__))
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options] [delay [count]]\n", _(" %s [options] [delay [count]]\n"),
program_invocation_short_name); program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --active active/inactive memory\n"), out); fputs(_(" -a, --active active/inactive memory\n"), out);
@ -158,13 +158,48 @@ static int format_1000(unsigned long long val64, char *restrict dst)
static void new_header(void) static void new_header(void)
{ {
printf /* Translation Hint: Translating folloging header & fields
("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n"); * that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
printf(_("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n"));
printf printf
("%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n", ("%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n",
"r", "b", "swpd", "free", a_option ? "inact" : "buff", /* Translation Hint: max 2 chars */
a_option ? "active" : "cache", "si", "so", "bi", "bo", "in", "cs", _("r"),
"us", "sy", "id", "wa"); /* Translation Hint: max 2 chars */
_("b"),
/* Translation Hint: max 6 chars */
_("swpd"),
/* Translation Hint: max 6 chars */
_("free"),
/* Translation Hint: max 6 chars */
a_option ? _("inact") :
/* Translation Hint: max 6 chars */
_("buff"),
/* Translation Hint: max 6 chars */
a_option ? _("active") :
/* Translation Hint: max 6 chars */
_("cache"),
/* Translation Hint: max 4 chars */
_("si"),
/* Translation Hint: max 4 chars */
_("so"),
/* Translation Hint: max 5 chars */
_("bi"),
/* Translation Hint: max 5 chars */
_("bo"),
/* Translation Hint: max 4 chars */
_("in"),
/* Translation Hint: max 4 chars */
_("cs"),
/* Translation Hint: max 2 chars */
_("us"),
/* Translation Hint: max 2 chars */
_("sy"),
/* Translation Hint: max 2 chars */
_("id"),
/* Translation Hint: max 2 chars */
_("wa"));
} }
static unsigned long unitConvert(unsigned int size) static unsigned long unitConvert(unsigned int size)
@ -294,8 +329,23 @@ static void new_format(void)
static void diskpartition_header(const char *partition_name) static void diskpartition_header(const char *partition_name)
{ {
printf("%-10s %10s %10s %10s %10s\n", partition_name, _("reads "), printf("%-10s %10s %10s %10s %10s\n",
_("read sectors"), _("writes "), _("requested writes")); partition_name,
/* Translation Hint: Translating folloging disk partition
* header fields that follow (marked with max x chars) might
* not work, unless manual page is translated as well. */
/* Translation Hint: max 10 chars. The word is
* expected to be centralized, use spaces at the end
* to do that. */
_("reads "),
/* Translation Hint: max 10 chars */
_("read sectors"),
/* Translation Hint: max 10 chars. The word is
* expected to be centralized, use spaces at the end
* to do that. */
_("writes "),
/* Translation Hint: max 10 chars */
_("requested writes"));
} }
static int diskpartition_format(const char *partition_name) static int diskpartition_format(const char *partition_name)
@ -363,11 +413,32 @@ static int diskpartition_format(const char *partition_name)
static void diskheader(void) static void diskheader(void)
{ {
/* Translation Hint: Translating folloging header & fields
* that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
printf(_("disk- ------------reads------------ ------------writes----------- -----IO------\n")); printf(_("disk- ------------reads------------ ------------writes----------- -----IO------\n"));
printf("%5s %6s %6s %7s %7s %6s %6s %7s %7s %6s %6s\n", printf("%5s %6s %6s %7s %7s %6s %6s %7s %7s %6s %6s\n",
" ", _("total"), _("merged"), _("sectors"), _("ms"), _("total"), " ",
_("merged"), _("sectors"), _("ms"), _("cur"), _("sec")); /* Translation Hint: max 6 chars */
_("total"),
/* Translation Hint: max 6 chars */
_("merged"),
/* Translation Hint: max 7 chars */
_("sectors"),
/* Translation Hint: max 7 chars */
_("ms"),
/* Translation Hint: max 6 chars */
_("total"),
/* Translation Hint: max 6 chars */
_("merged"),
/* Translation Hint: max 7 chars */
_("sectors"),
/* Translation Hint: max 7 chars */
_("ms"),
/* Translation Hint: max 6 chars */
_("cur"),
/* Translation Hint: max 6 chars */
_("sec"));
} }
static void diskformat(void) static void diskformat(void)
@ -434,8 +505,20 @@ static void diskformat(void)
static void slabheader(void) static void slabheader(void)
{ {
printf("%-24s %6s %6s %6s %6s\n", _("Cache"), _("Num"), _("Total"), printf("%-24s %6s %6s %6s %6s\n",
_("Size"), _("Pages")); /* Translation Hint: Translating folloging slab fields that
* follow (marked with max x chars) might not work, unless
* manual page is translated as well. */
/* Translation Hint: max 24 chars */
_("Cache"),
/* Translation Hint: max 6 chars */
_("Num"),
/* Translation Hint: max 6 chars */
_("Total"),
/* Translation Hint: max 6 chars */
_("Size"),
/* Translation Hint: max 6 chars */
_("Pages"));
} }
static void slabformat(void) static void slabformat(void)
@ -680,8 +763,8 @@ int main(int argc, char *argv[])
break; break;
default: default:
errx(EXIT_FAILURE, errx(EXIT_FAILURE,
_ /* Translation Hint: do not change argument characters */
("-S requires k, K, m or M (default is kb)")); _("-S requires k, K, m or M (default is kb)"));
} }
szDataUnit[0] = optarg[0]; szDataUnit[0] = optarg[0];
break; break;

12
w.c
View File

@ -303,7 +303,7 @@ static void __attribute__ ((__noreturn__))
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options]\n", program_invocation_short_name); _(" %s [options]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" -h, --no-header do not print header\n"), out); fputs(_(" -h, --no-header do not print header\n"), out);
fputs(_(" -u, --no-current ignore current process username\n"), out); fputs(_(" -u, --no-current ignore current process username\n"), out);
@ -422,13 +422,15 @@ int main(int argc, char **argv)
if (header) { if (header) {
/* print uptime and headers */ /* print uptime and headers */
print_uptime(); print_uptime();
printf("%-*s TTY ", userlen, "USER"); /* Translation Hint: Following five uppercase messages are
* headers. Try to keep alignment intact. */
printf(_("%-*s TTY "), userlen, _("USER"));
if (from) if (from)
printf("FROM "); printf(_("FROM "));
if (longform) if (longform)
printf(" LOGIN@ IDLE JCPU PCPU WHAT\n"); printf(_(" LOGIN@ IDLE JCPU PCPU WHAT\n"));
else else
printf(" IDLE WHAT\n"); printf(_(" IDLE WHAT\n"));
} }
utmpname(UTMP_FILE); utmpname(UTMP_FILE);

View File

@ -61,7 +61,7 @@ static void __attribute__ ((__noreturn__))
{ {
fputs(USAGE_HEADER, out); fputs(USAGE_HEADER, out);
fprintf(out, fprintf(out,
" %s [options] command\n", program_invocation_short_name); _(" %s [options] command\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out); fputs(USAGE_OPTIONS, out);
fputs(_(" -b, --beep beep if command has a non-zero exit\n"), out); fputs(_(" -b, --beep beep if command has a non-zero exit\n"), out);
fputs(_(" -c, --color interpret ANSI color sequences\n"), out); fputs(_(" -c, --color interpret ANSI color sequences\n"), out);