]> granicus.if.org Git - procps-ng/commitdiff
top: enable exclusion of some strings from translation
authorJim Warner <james.warner@comcast.net>
Sat, 1 Oct 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Mon, 3 Oct 2022 23:57:34 +0000 (10:57 +1100)
The provision excluding some strings is intended to be
used very sparingly. It exists in case we collide with
some translation project person in a position to delay
a future release over his or her personal preferences.

(it's currently used only on v4.0.1 command line help)

Signed-off-by: Jim Warner <james.warner@comcast.net>
src/top/top.h
src/top/top_nls.c

index 17920025557b141ed614b9527b3cd4db8694a65a..937152bfb7ac7dab6c63e5858d722ea6bbeb99ea 100644 (file)
@@ -42,6 +42,8 @@
 //#define INSP_SAVEBUF            /* preserve 'Insp_buf' contents via a file */
 //#define INSP_SLIDE_1            /* when scrolling left/right, don't move 8 */
 //#define MEMGRAPH_OLD            /* don't use 'available' when graphing Mem */
+//#define NLS_INCLUDED            /* provides for excluding from translation */
+//#define NLS_VALIDATE            /* ensure the integrity of four nls tables */
 //#define OFF_SCROLLBK            /* disable tty emulators scrollback buffer */
 //#define OFF_STDERROR            /* disable our stderr buffering (redirect) */
 //#define OFF_STDIOLBF            /* disable our own stdout 'IOFBF' override */
@@ -74,7 +76,6 @@
 //#define TREE_VPROMPT            /* pid collapse/expand prompt, vs. top row */
 //#define TREE_VWINALL            /* pid collapse/expand impacts all windows */
 //#define USE_X_COLHDR            /* emphasize header vs. whole col, for 'x' */
-//#define VALIDATE_NLS            /* ensure the integrity of four nls tables */
 //#define WIDEN_COLUMN            /* base column widths on translated header */
 
 
index 869a88cf37da85afb136dababd2f2ad3efd85f12..6dde025820a8db6601de090f6c4fa70ad9ec1772 100644 (file)
 #include "top.h"
 #include "top_nls.h"
 
-#ifdef VALIDATE_NLS
+#ifdef NLS_VALIDATE
 #include <stdlib.h>
+#endif
+
+        /*
+         * The provision excluding some strings is intended to be
+         * used very sparingly. It exists in case we collide with
+         * some translation project person in a position to delay
+         * a future release over his or her personal preferences.
+         * (it's currently used only on v4.0.1 command line help) */
+#ifdef NLS_INCLUDED
+# define _X(str) _(str)
+#else
+# define _X(str)  (str)
 #endif
 
         // Programmer Note(s):
@@ -393,7 +405,7 @@ static void build_norm_nlstab (void) {
    Norm_nlstab[WRONG_switch_fmt] = _(""
       "inappropriate '%s'\n"
       "Usage:\n  %s%s");
-   Norm_nlstab[HELP_cmdline_fmt] = _("\n"
+   Norm_nlstab[HELP_cmdline_fmt] = _X("\n"
       "Usage:\n"
       " %s [options]\n"
       "\n"
@@ -787,7 +799,7 @@ static void build_uniq_nlstab (void) {
         /*
          * This function must be called very early at startup, before
          * any other function call, and especially before any changes
-         * have been made to the terminal if VALIDATE_NLS is defined!
+         * have been made to the terminal if NLS_VALIDATE is defined!
          *
          * The gettext documentation suggests that alone among locale
          * variables LANGUAGE=ll_CC may be abbreviated as LANGUAGE=ll
@@ -804,7 +816,7 @@ static void build_uniq_nlstab (void) {
          * enable any translations.
          */
 void initialize_nls (void) {
-#ifdef VALIDATE_NLS
+#ifdef NLS_VALIDATE
    static const char *nls_err ="\t%s_nlstab[%d] == NULL\n";
    int i;