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 {
meminfo();
printf("%7s %10s %10s %10s %10s %10s %10s\n",
"", _("total"), _("used"), _("free"), _("shared"),
_("buffers"), _("cached"));
/* Translation Hint: You can use 9 character words in
* the header, and the words need to be right align to
* beginning of a number. */
printf("%s\n", _(" total used free shared buffers cached"));
printf("%-7s", _("Mem:"));
printf(" %10s", scale_size(kb_main_total, 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)
usage (0);
else if (criteria_count == 0) {
warnx(_("No matching criteria specified"));
warnx(_("no matching criteria specified"));
usage (0);
}
}

11
pmap.c
View File

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

View File

@ -496,5 +496,5 @@ void self_info(void){
fprintf(stderr, _("archdefs:%s\n"), archdefs);
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);
fprintf(out,
" %s [options]\n", program_invocation_short_name);
_(" %s [options]\n"), program_invocation_short_name);
if (section == USAGE_SELECTION || section == USAGE_ALL) {
fputs(_("\nSimple options:\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);
}
if (section == USAGE_DEFAULT)
fprintf(out,
_("\n Try `%s --help <selection|list|output|threads|misc|all>'\n"
" for more information.\n"), program_invocation_short_name);
/* Translation Hint: do not translate arguments, that breaks
* 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)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}

View File

@ -1134,7 +1134,7 @@ static const char *parse_all_options(void){
return _("Garbage option.");
break;
default:
printf(_(" ? %s\n"),ps_argv[thisarg]);
printf(" ? %s\n",ps_argv[thisarg]);
return _("Something broke.");
} /* switch */
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" ;
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->next = fnode;
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->next = sfn->f_cooked;
sfn->f_cooked = fnode;
@ -792,7 +792,7 @@ const char *process_sf_options(int localbroken){
// with sorting. Do the threads remain grouped, with sorting
// by process, or do the threads get sorted by themselves?
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.
@ -802,7 +802,7 @@ const char *process_sf_options(int localbroken){
if(tmp && *tmp){
const char *err;
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.f_cooked = NULL;
err = format_parse(&sfn);

2
pwdx.c
View File

@ -26,7 +26,7 @@
static void __attribute__ ((__noreturn__)) usage(FILE * 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_HELP, out);
fputs(USAGE_VERSION, out);

View File

@ -187,6 +187,8 @@ static void show_lists(void)
{
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, _("%d TTY: "), tty_count);
@ -261,7 +263,7 @@ static void __attribute__ ((__noreturn__)) kill_usage(FILE * out)
{
fputs(USAGE_HEADER, out);
fprintf(out,
" %s [options] <pid> [...]\n", program_invocation_short_name);
_(" %s [options] <pid> [...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(_(" <pid> [...] send signal to every <pid> listed\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) {
fprintf(out,
" %s [signal] [options] <expression>\n",
_(" %s [signal] [options] <expression>\n"),
program_invocation_short_name);
} else {
fprintf(out,
" %s [new priority] [options] <expression>\n",
_(" %s [new priority] [options] <expression>\n"),
program_invocation_short_name);
}
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)
{
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);
fprintf(out, _(" -d, --delay <secs> delay updates\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)
warn(_("tcgetattr"));
warn(_("terminal setting retrieval"));
old_rows = rows;
term_size(0);
@ -359,6 +359,8 @@ int main(int argc, char *argv[])
" %-35s: %d / %d (%.1f%%)\n"
" %-35s: %.2fK / %.2fK (%.1f%%)\n"
" %-35s: %.2fK / %.2fK / %.2fK\n\n",
/* Translation Hint: Next five strings must not
* exceed 35 length in characters. */
_("Active / Total Objects (% used)"),
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);
attron(A_REVERSE);
print_line("%6s %6s %4s %8s %6s %8s %10s %-23s\n",
_("OBJS"), _("ACTIVE"), _("USE"), _("OBJ SIZE"),
_("SLABS"), _("OBJ/SLAB"), _("CACHE SIZE"),
_("NAME"));
/* Translation Hint: Please keep alignment of the
* following intact. */
printw("%-78s\n", _(" OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME"));
attroff(A_REVERSE);
curr = slab_list;

View File

@ -90,7 +90,7 @@ static void __attribute__ ((__noreturn__))
{
fputs(USAGE_HEADER, 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(_(" -a, --all display all variables\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)
{
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(_(" -d, --delay <secs> update delay in seconds\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);
fprintf(out,
" %s [options] [delay [count]]\n",
_(" %s [options] [delay [count]]\n"),
program_invocation_short_name);
fputs(USAGE_OPTIONS, 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)
{
printf
("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n");
/* Translation Hint: Translating folloging header & fields
* 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
("%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",
a_option ? "active" : "cache", "si", "so", "bi", "bo", "in", "cs",
"us", "sy", "id", "wa");
/* Translation Hint: max 2 chars */
_("r"),
/* 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)
@ -294,8 +329,23 @@ static void new_format(void)
static void diskpartition_header(const char *partition_name)
{
printf("%-10s %10s %10s %10s %10s\n", partition_name, _("reads "),
_("read sectors"), _("writes "), _("requested writes"));
printf("%-10s %10s %10s %10s %10s\n",
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)
@ -363,11 +413,32 @@ static int diskpartition_format(const char *partition_name)
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("%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)
@ -434,8 +505,20 @@ static void diskformat(void)
static void slabheader(void)
{
printf("%-24s %6s %6s %6s %6s\n", _("Cache"), _("Num"), _("Total"),
_("Size"), _("Pages"));
printf("%-24s %6s %6s %6s %6s\n",
/* 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)
@ -680,8 +763,8 @@ int main(int argc, char *argv[])
break;
default:
errx(EXIT_FAILURE,
_
("-S requires k, K, m or M (default is kb)"));
/* Translation Hint: do not change argument characters */
_("-S requires k, K, m or M (default is kb)"));
}
szDataUnit[0] = optarg[0];
break;

12
w.c
View File

@ -303,7 +303,7 @@ static void __attribute__ ((__noreturn__))
{
fputs(USAGE_HEADER, out);
fprintf(out,
" %s [options]\n", program_invocation_short_name);
_(" %s [options]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(_(" -h, --no-header do not print header\n"), out);
fputs(_(" -u, --no-current ignore current process username\n"), out);
@ -422,13 +422,15 @@ int main(int argc, char **argv)
if (header) {
/* print uptime and headers */
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)
printf("FROM ");
printf(_("FROM "));
if (longform)
printf(" LOGIN@ IDLE JCPU PCPU WHAT\n");
printf(_(" LOGIN@ IDLE JCPU PCPU WHAT\n"));
else
printf(" IDLE WHAT\n");
printf(_(" IDLE WHAT\n"));
}
utmpname(UTMP_FILE);

View File

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