]> granicus.if.org Git - procps-ng/commitdiff
top: make 'n/a' (not applicable) notation translatable
authorJim Warner <james.warner@comcast.net>
Thu, 16 Jun 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Mon, 20 Jun 2022 09:18:02 +0000 (19:18 +1000)
Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c
top/top_nls.c
top/top_nls.h

index 39c511ad76a53a6b32e161cc23262d4c1c710cb4..9f8d5d30ceeba06d89e95531141df4b3e3a217a4 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5010,7 +5010,7 @@ static int bot_focus_str (const char *hdr, const char *str) {
       memset(Bot_buf, '\0', sizeof(Bot_buf));
       n = strlen(str);
       if (n >= sizeof(Bot_buf)) n = sizeof(Bot_buf) - 1;
-      if (!*str || !strcmp(str, "-")) strcpy(Bot_buf, "n/a");
+      if (!*str || !strcmp(str, "-")) strcpy(Bot_buf, N_txt(X_BOT_nodata_txt));
       else memccpy(Bot_buf, str, '\0', n);
       Bot_rsvd = 1 + BOT_RSVD + ((strlen(Bot_buf) - utf8_delta(Bot_buf)) / Screen_cols);
       if (Bot_rsvd > maxRSVD) Bot_rsvd = maxRSVD;
@@ -5062,7 +5062,7 @@ static int bot_focus_strv (const char *hdr, const char **strv) {
       if (n >= sizeof(Bot_buf)) n = sizeof(Bot_buf) - 1;
       memcpy(Bot_buf, strv[0], n);
       if (!Bot_buf[0] || (!strcmp(Bot_buf, "-") && n <= sizeof(char *)))
-         strcpy(Bot_buf, "n/a");
+         strcpy(Bot_buf, N_txt(X_BOT_nodata_txt));
       for (nsav= 0, p = Bot_buf, x = 0; strv[nsav] != NULL; nsav++) {
          p += strlen(strv[nsav]) + 1;
          if ((p - Bot_buf) >= sizeof(Bot_buf))
index e539c5c03f06a67abc38ea9fc2d4f13c6620905d..fe5fab6079c9337d8eb931e72f8aa244fd7be197 100644 (file)
@@ -595,6 +595,7 @@ static void build_norm_nlstab (void) {
    Norm_nlstab[X_BOT_ctlgrp_fmt] = _("control groups for pid %d, %s");
    Norm_nlstab[X_BOT_envirn_fmt] = _("environment for pid %d, %s");
    Norm_nlstab[X_BOT_namesp_fmt] = _("namespaces for pid %d, %s");
+   Norm_nlstab[X_BOT_nodata_txt] = _("n/a");
    Norm_nlstab[X_BOT_supgrp_fmt] = _("supplementary groups for pid %d, %s");
    Norm_nlstab[X_BOT_msglog_txt] = _("message log, last 10 messages:");
 }
index 6a116ccb0d4287d184bcc511d2964109dce7d97c..22fffa9cec41c156ee4954f3d73782369a09777d 100644 (file)
@@ -86,8 +86,8 @@ enum norm_nls {
    XTRA_badflds_fmt, XTRA_fixwide_fmt, XTRA_modebad_txt, XTRA_size2up_txt,
    XTRA_vforest_fmt, XTRA_warncfg_txt, XTRA_warnold_txt, XTRA_winsize_txt,
    X_BOT_cmdlin_fmt, X_BOT_ctlgrp_fmt, X_BOT_envirn_fmt, X_BOT_msglog_txt,
-   X_BOT_namesp_fmt, X_BOT_supgrp_fmt, X_RESTRICTED_txt, X_SEMAPHORES_fmt,
-   X_THREADINGS_fmt,
+   X_BOT_namesp_fmt, X_BOT_nodata_txt, X_BOT_supgrp_fmt, X_RESTRICTED_txt,
+   X_SEMAPHORES_fmt, X_THREADINGS_fmt,
    YINSP_demo01_txt, YINSP_demo02_txt, YINSP_demo03_txt, YINSP_deqfmt_txt,
    YINSP_deqtyp_txt, YINSP_dstory_txt,
    YINSP_failed_fmt, YINSP_noent1_txt, YINSP_noent2_txt, YINSP_pidbad_fmt,