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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-10-01 00:00:00 -05:00 committed by Craig Small
parent c7568b28fb
commit 8a368bfb05
2 changed files with 18 additions and 5 deletions

View 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 */

View File

@ -24,8 +24,20 @@
#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;