From 8a368bfb05a978a9904647f128dec8f1c4d4cc84 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sat, 1 Oct 2022 00:00:00 -0500 Subject: [PATCH] top: enable exclusion of some strings from translation 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 --- src/top/top.h | 3 ++- src/top/top_nls.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/top/top.h b/src/top/top.h index 17920025..937152bf 100644 --- a/src/top/top.h +++ b/src/top/top.h @@ -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 */ diff --git a/src/top/top_nls.c b/src/top/top_nls.c index 869a88cf..6dde0258 100644 --- a/src/top/top_nls.c +++ b/src/top/top_nls.c @@ -24,8 +24,20 @@ #include "top.h" #include "top_nls.h" -#ifdef VALIDATE_NLS +#ifdef NLS_VALIDATE #include +#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;