]> granicus.if.org Git - procps-ng/commitdiff
nls: improve translations and provide translator help comments
authorSami Kerola <kerolasa@iki.fi>
Sat, 17 Dec 2011 17:32:47 +0000 (18:32 +0100)
committerSami Kerola <kerolasa@iki.fi>
Tue, 20 Dec 2011 16:30:54 +0000 (17:30 +0100)
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>
15 files changed:
free.c
pgrep.c
pmap.c
ps/global.c
ps/help.c
ps/parser.c
ps/sortformat.c
pwdx.c
skill.c
slabtop.c
sysctl.c
tload.c
vmstat.c
w.c
watch.c

diff --git a/free.c b/free.c
index 6fb183e442752dfba42fb3378911340adfdb328f..0667b4190c18088375ce69be121c8443880ea1d8 100644 (file)
--- a/free.c
+++ b/free.c
@@ -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));
diff --git a/pgrep.c b/pgrep.c
index 8cb4a82cce86e2a263f0b5128f92a72f4ed86830..119c243035cb05a8c1846c361858021a0fc0cd89 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -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);
        }
 }
diff --git a/pmap.c b/pmap.c
index 1c9bcc8774a3875c374d5650e780f953670111ba..116dc9c98b2bea6a2c91489dbc5217cb96f4dc69 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -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);
index 567d02987e13d1d0653bef18de87c275e8907f5f..4a88525c2bbe8c2b7144bad2cb121ec97812d685 100644 (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>"));
 }
index 866f1a8f897f60d5769a7d7e78a3636d50b30006..a103c7985020a69ebd18d851d79cff2edf087da6 100644 (file)
--- a/ps/help.c
+++ b/ps/help.c
@@ -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);
 }
index 3bd75ae52ad56a70c8f292f116f4fb1f30659abf..552face3d8108657af39064676f8aa62c6d90bc1 100644 (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;
index 696e3ed24fe5c6a216d5917fd05a013b3ab4c434..663ffee437ae165ace740748858e413bf3ea0896 100644 (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);
diff --git a/pwdx.c b/pwdx.c
index 2c699086aeba453d1f28d1fe3290d62b5cf4fcf7..cb62411f1c4baa278520ce31d90a178d20e75d16 100644 (file)
--- a/pwdx.c
+++ b/pwdx.c
@@ -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);
diff --git a/skill.c b/skill.c
index 22e9617eb10b3a47c005399727ee7437a9c54024..798497d772ac6e6a805f9ff48c33c700a5f19f61 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -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);
index 7d32d49747a300bf5c6949c96f34122286a10493..648357e0b41ee7d0b6f840c67f7f1b1c5dbb898e 100644 (file)
--- a/slabtop.c
+++ b/slabtop.c
@@ -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;
index e51f8d6f9bc7885c0d087f4ec3b007f45bc55a8c..6c5255bfa6127cdae154f77247b2dff2d991af4e 100644 (file)
--- a/sysctl.c
+++ b/sysctl.c
@@ -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);
diff --git a/tload.c b/tload.c
index 23b243d12f6c92733efb64aa8f7d38a56adaca67..ebd5e392d9e9ae5da4e594138c05208383307f34 100644 (file)
--- a/tload.c
+++ b/tload.c
@@ -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);
index a81ecdf2167d62da2ac5173d5859c8bf486a1be8..ee13563f5bbc860e9d764a74ba8c8c13cdb26f6e 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -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;
diff --git a/w.c b/w.c
index 001b0724a7ee1549d5c157fb86a6c718a673084d..9a1a2f49b82aa9803bf79206c5f5a73344c5b066 100644 (file)
--- a/w.c
+++ b/w.c
@@ -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);
diff --git a/watch.c b/watch.c
index 97dce3d6ccfd691f00ba73a1e8f3590a4c1511f3..13f3c4e98bc7863c1610e4abdfd09cc8190f8b7d 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -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);