]> granicus.if.org Git - procps-ng/blob - src/top/top_nls.c
84d8acd1b53652d5bbf9a800c22ed18aa4fb4aa1
[procps-ng] / src / top / top_nls.c
1 /* top_nls.c - provide the basis for future nls translations */
2 /*
3  * Copyright (c) 2011-2022, by: Jim Warner <james.warner@comcast.net
4  *
5  * This file may be used subject to the terms and conditions of the
6  * GNU Library General Public License Version 2, or any later version
7  * at your option, as published by the Free Software Foundation.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Library General Public License for more details.
12  */
13 /* For contributions to this program, the author wishes to thank:
14  *    Craig Small, <csmall@dropbear.xyz>
15  *    Sami Kerola, <kerolasa@iki.fi>
16  */
17
18 #include <locale.h>
19 #include <stdio.h>
20 #include <string.h>
21
22 #include "nls.h"
23
24 #include "top.h"
25 #include "top_nls.h"
26
27 #ifdef NLS_VALIDATE
28 #include <stdlib.h>
29 #endif
30
31
32         /*
33          * The provision excluding some strings is intended to be
34          * used very sparingly. It exists in case we collide with
35          * some translation project person in a position to delay
36          * a future release over his or her personal preferences.
37          *
38          * If it's ever enabled, it will produce a fatal compiler
39          * error as our only option since those gettext tools are
40          * far too primitive to be influenced with a conditional.
41          * They always ignore a '_X()' macro no matter its state. */
42
43 #ifndef NLS_INCLUDED
44 # define _X(str)  (str)
45 #else
46 # define _X(str)
47 # error instead of this #define, restore the true gettext macro(s)
48 #endif
49
50         // Programmer Note(s):
51         //  Preparation ---------------------------------------------
52         //    Unless you have *something* following the gettext macro,
53         //    xgettext will refuse to see any TRANSLATORS comments.
54         //    Thus empty strings have been added for potential future
55         //    comment additions.
56         //
57         //    Also, by omitting the argument for the --add-comments
58         //    XGETTEXT_OPTION in po/Makevars, *any* preceding c style
59         //    comment will be propagated to the .pot file, providing
60         //    that the gettext macro isn't empty as discussed above.
61         //    However, this is far too aggressive so we have chosen
62         //    the word 'Translation' to denote xgettext comments.
63         //
64         //    /* Need Not Say 'TRANSLATORS': ...
65         //    snprintf(buf, sizeof(buf), "%s", _(      // unseen comment
66         //
67         //    /* Translation Hint: ...
68         //    snprintf(buf, sizeof(buf), "%s", _(""    // now it's seen!
69         //
70         //  Translation, from po/ directory after make --------------
71         //  ( this is the procedure used before any translations were  )
72         //  ( available in the po/ directory, which contained only the )
73         //  ( procps-ng.pot, this domain's template file.              )
74         //
75         //  ( below: ll_CC = language/country as in 'zh_CN' or 'en_AU' )
76         //
77         //    msginit --locale=ll_CC --no-wrap
78         //     . creates a ll_CC.po file from the template procps-ng.pot
79         //     . may also duplicate msgid as msgstr if languages similar
80         //    msgen --no-wrap ll_CC.po --output-file=ll_CC.po
81         //     . duplicates every msgid literal as msgstr value
82         //     . this is the file that's edited
83         //        . replace "Content-Type: ... charset=ASCII\n"
84         //                           with "... charset=UTF-8\n"
85         //        . translate msgstr values, leaving msgid unchanged
86         //    msgfmt ll_CC.po --strict --output-file=procps-ng.mo
87         //     . after which ensure, chmod 644
88         //     . then copy
89         //         to /usr/share/locale-langpack/ll_CC/LC_MESSAGES/
90         //         or /usr/share/locale/ll_CC/LC_MESSAGES/
91         //  Testing -------------------------------------------------
92         //    export LC_ALL= && export LANGUAGE=ll_CC
93         //    run some capable program like top
94         //
95
96         /*
97          * These are our string tables with the following contents:
98          *    Head : column headings with varying size limits
99          *    Desc : fields descriptions not to exceed 20 screen positions
100          *    Norm : regular text possibly also containing c-format specifiers
101          *    Uniq : show_special specially formatted strings
102          *
103          * The latter table presents the greatest translation challenge !
104          *
105          * We go to the trouble of creating the nls string tables to achieve
106          * these objectives:
107          *    +  the overhead of repeated runtime calls to gettext()
108          *       will be avoided
109          *    +  the order of the strings in the template (.pot) file
110          *       can be completely controlled
111          *    +  none of the important translator only comments will
112          *       clutter and obscure the main program
113          */
114 const char *Head_nlstab[EU_MAXPFLGS];
115 const char *Desc_nlstab[EU_MAXPFLGS];
116 const char *Norm_nlstab[norm_MAX];
117 const char *Uniq_nlstab[uniq_MAX];
118
119
120         /*
121          * This routine builds the nls table containing plain text only
122          * used as the field descriptions.  Each translated line MUST be
123          * kept to a maximum of 20 characters or less! */
124 static void build_two_nlstabs (void) {
125
126 /* Translation Notes ------------------------------------------------
127    .  It is strongly recommend that the --no-wrap command line option
128    .  be used with all supporting translation tools, when available.
129    .
130    .  The following line pairs contain only plain text and consist of:
131    .     1) a field name/column header - mostly upper case
132    .     2) the related description    - both upper and lower case
133    .
134    .  To avoid truncation on the main top display, each column header
135    .  is noted with its maximum size, while a few are 'variable' width.
136    .  Names for the latter should probably be 10 or fewer characters.
137    .
138    .  Those fields shown with a '+' are also eligible for user resizing
139    .  using the 'X' command. That means the default width might produce
140    .  truncation but need not if widened (see the man page 'X' command).
141    .
142    .  All headers are subject to a maximum of 8 on the Fields Management
143    .  screen where truncation is entirely acceptable.
144    .
145    .  The associated descriptions are always limited to 20 characters,
146    .  and are used only on the Fields Management screen.
147    .
148    .  In all cases, fewer characters are just fine.
149    . */
150
151 /* Translation Hint: maximum 'PID' = 5 */
152    Head_nlstab[EU_PID] = _("PID");
153    Desc_nlstab[EU_PID] = _("Process Id");
154 /* Translation Hint: maximum 'PPID' = 5 */
155    Head_nlstab[EU_PPD] = _("PPID");
156    Desc_nlstab[EU_PPD] = _("Parent Process pid");
157 /* Translation Hint: maximum 'UID' = 5 + */
158    Head_nlstab[EU_UED] = _("UID");
159    Desc_nlstab[EU_UED] = _("Effective User Id");
160 /* Translation Hint: maximum 'USER' = 8 + */
161    Head_nlstab[EU_UEN] = _("USER");
162    Desc_nlstab[EU_UEN] = _("Effective User Name");
163 /* Translation Hint: maximum 'RUID' = 5 + */
164    Head_nlstab[EU_URD] = _("RUID");
165    Desc_nlstab[EU_URD] = _("Real User Id");
166 /* Translation Hint: maximum 'RUSER' = 8 + */
167    Head_nlstab[EU_URN] = _("RUSER");
168    Desc_nlstab[EU_URN] = _("Real User Name");
169 /* Translation Hint: maximum 'SUID' = 5 + */
170    Head_nlstab[EU_USD] = _("SUID");
171    Desc_nlstab[EU_USD] = _("Saved User Id");
172 /* Translation Hint: maximum 'SUSER' = 8 + */
173    Head_nlstab[EU_USN] = _("SUSER");
174    Desc_nlstab[EU_USN] = _("Saved User Name");
175 /* Translation Hint: maximum 'GID' = 5 + */
176    Head_nlstab[EU_GID] = _("GID");
177    Desc_nlstab[EU_GID] = _("Group Id");
178 /* Translation Hint: maximum 'GROUP' = 8 + */
179    Head_nlstab[EU_GRP] = _("GROUP");
180    Desc_nlstab[EU_GRP] = _("Group Name");
181 /* Translation Hint: maximum 'PGRP' = 5 */
182    Head_nlstab[EU_PGD] = _("PGRP");
183    Desc_nlstab[EU_PGD] = _("Process Group Id");
184 /* Translation Hint: maximum 'TTY' = 8 + */
185    Head_nlstab[EU_TTY] = _("TTY");
186    Desc_nlstab[EU_TTY] = _("Controlling Tty");
187 /* Translation Hint: maximum 'TPGID' = 5 */
188    Head_nlstab[EU_TPG] = _("TPGID");
189    Desc_nlstab[EU_TPG] = _("Tty Process Grp Id");
190 /* Translation Hint: maximum 'SID' = 5 */
191    Head_nlstab[EU_SID] = _("SID");
192    Desc_nlstab[EU_SID] = _("Session Id");
193 /* Translation Hint: maximum 'PR' = 3 */
194    Head_nlstab[EU_PRI] = _("PR");
195    Desc_nlstab[EU_PRI] = _("Priority");
196 /* Translation Hint: maximum 'NI' = 3 */
197    Head_nlstab[EU_NCE] = _("NI");
198    Desc_nlstab[EU_NCE] = _("Nice Value");
199 /* Translation Hint: maximum 'nTH' = 3 */
200    Head_nlstab[EU_THD] = _("nTH");
201    Desc_nlstab[EU_THD] = _("Number of Threads");
202 /* Translation Hint: maximum 'P' = 1 */
203    Head_nlstab[EU_CPN] = _("P");
204    Desc_nlstab[EU_CPN] = _("Last Used Cpu (SMP)");
205 /* Translation Hint: maximum '%CPU' = 4 */
206    Head_nlstab[EU_CPU] = _("%CPU");
207    Desc_nlstab[EU_CPU] = _("CPU Usage");
208 /* Translation Hint: maximum '' = 6 */
209    Head_nlstab[EU_TME] = _("TIME");
210    Desc_nlstab[EU_TME] = _("CPU Time");
211 /* Translation Hint: maximum 'TIME+' = 9 */
212    Head_nlstab[EU_TM2] = _("TIME+");
213    Desc_nlstab[EU_TM2] = _("CPU Time, hundredths");
214 /* Translation Hint: maximum '%MEM' = 4 */
215    Head_nlstab[EU_MEM] = _("%MEM");
216    Desc_nlstab[EU_MEM] = _("Memory Usage (RES)");
217 /* Translation Hint: maximum 'VIRT' = 7 */
218    Head_nlstab[EU_VRT] = _("VIRT");
219    Desc_nlstab[EU_VRT] = _("Virtual Image (KiB)");
220 /* Translation Hint: maximum 'SWAP' = 6 */
221    Head_nlstab[EU_SWP] = _("SWAP");
222    Desc_nlstab[EU_SWP] = _("Swapped Size (KiB)");
223 /* Translation Hint: maximum 'RES' = 6 */
224    Head_nlstab[EU_RES] = _("RES");
225    Desc_nlstab[EU_RES] = _("Resident Size (KiB)");
226 /* Translation Hint: maximum 'CODE' = 4 */
227    Head_nlstab[EU_COD] = _("CODE");
228    Desc_nlstab[EU_COD] = _("Code Size (KiB)");
229 /* Translation Hint: maximum 'DATA' = 7 */
230    Head_nlstab[EU_DAT] = _("DATA");
231    Desc_nlstab[EU_DAT] = _("Data+Stack (KiB)");
232 /* Translation Hint: maximum 'SHR' = 6 */
233    Head_nlstab[EU_SHR] = _("SHR");
234    Desc_nlstab[EU_SHR] = _("Shared Memory (KiB)");
235 /* Translation Hint: maximum 'nMaj' = 4 */
236    Head_nlstab[EU_FL1] = _("nMaj");
237    Desc_nlstab[EU_FL1] = _("Major Page Faults");
238 /* Translation Hint: maximum 'nMin' = 4 */
239    Head_nlstab[EU_FL2] = _("nMin");
240    Desc_nlstab[EU_FL2] = _("Minor Page Faults");
241 /* Translation Hint: maximum 'nDRT' = 4 */
242    Head_nlstab[EU_DRT] = _("nDRT");
243    Desc_nlstab[EU_DRT] = _("Dirty Pages Count");
244 /* Translation Hint: maximum 'S' = 1 */
245    Head_nlstab[EU_STA] = _("S");
246    Desc_nlstab[EU_STA] = _("Process Status");
247 /* Translation Hint: maximum 'COMMAND' = variable */
248    Head_nlstab[EU_CMD] = _("COMMAND");
249    Desc_nlstab[EU_CMD] = _("Command Name/Line");
250 /* Translation Hint: maximum 'WCHAN' = 10 + */
251    Head_nlstab[EU_WCH] = _("WCHAN");
252    Desc_nlstab[EU_WCH] = _("Sleeping in Function");
253 /* Translation Hint: maximum 'Flags' = 8 */
254    Head_nlstab[EU_FLG] = _("Flags");
255    Desc_nlstab[EU_FLG] = _("Task Flags <sched.h>");
256 /* Translation Hint: maximum 'CGROUPS' = variable */
257    Head_nlstab[EU_CGR] = _("CGROUPS");
258    Desc_nlstab[EU_CGR] = _("Control Groups");
259 /* Translation Hint: maximum 'SUPGIDS' = variable */
260    Head_nlstab[EU_SGD] = _("SUPGIDS");
261    Desc_nlstab[EU_SGD] = _("Supp Groups IDs");
262 /* Translation Hint: maximum 'SUPGRPS' = variable */
263    Head_nlstab[EU_SGN] = _("SUPGRPS");
264    Desc_nlstab[EU_SGN] = _("Supp Groups Names");
265 /* Translation Hint: maximum 'TGID' = 5 */
266    Head_nlstab[EU_TGD] = _("TGID");
267    Desc_nlstab[EU_TGD] = _("Thread Group Id");
268 /* Translation Hint: maximum 'OOMa' = 5 */
269    Head_nlstab[EU_OOA] = _("OOMa");
270    Desc_nlstab[EU_OOA] = _("OOMEM Adjustment");
271 /* Translation Hint: maximum 'OOMs' = 4 */
272    Head_nlstab[EU_OOM] = _("OOMs");
273    Desc_nlstab[EU_OOM] = _("OOMEM Score current");
274 /* Translation Hint: maximum 'ENVIRON' = variable */
275    Head_nlstab[EU_ENV] = _("ENVIRON");
276 /* Translation Hint: the abbreviation 'vars' below is shorthand for
277                      'variables' */
278    Desc_nlstab[EU_ENV] = _("Environment vars");
279 /* Translation Hint: maximum 'vMj' = 3 */
280    Head_nlstab[EU_FV1] = _("vMj");
281    Desc_nlstab[EU_FV1] = _("Major Faults delta");
282 /* Translation Hint: maximum 'vMn' = 3 */
283    Head_nlstab[EU_FV2] = _("vMn");
284    Desc_nlstab[EU_FV2] = _("Minor Faults delta");
285 /* Translation Hint: maximum 'USED' = 6 */
286    Head_nlstab[EU_USE] = _("USED");
287    Desc_nlstab[EU_USE] = _("Res+Swap Size (KiB)");
288 /* Translation Hint: maximum 'nsIPC' = 10 + */
289    Head_nlstab[EU_NS1] = _("nsIPC");
290    Desc_nlstab[EU_NS1] = _("IPC namespace Inode");
291 /* Translation Hint: maximum 'nsMNT' = 10 + */
292    Head_nlstab[EU_NS2] = _("nsMNT");
293    Desc_nlstab[EU_NS2] = _("MNT namespace Inode");
294 /* Translation Hint: maximum 'nsNET' = 10 + */
295    Head_nlstab[EU_NS3] = _("nsNET");
296    Desc_nlstab[EU_NS3] = _("NET namespace Inode");
297 /* Translation Hint: maximum 'nsPID' = 10 + */
298    Head_nlstab[EU_NS4] = _("nsPID");
299    Desc_nlstab[EU_NS4] = _("PID namespace Inode");
300 /* Translation Hint: maximum 'nsUSER' = 10 + */
301    Head_nlstab[EU_NS5] = _("nsUSER");
302    Desc_nlstab[EU_NS5] = _("USER namespace Inode");
303 /* Translation Hint: maximum 'nsUTS' = 10 + */
304    Head_nlstab[EU_NS6] = _("nsUTS");
305    Desc_nlstab[EU_NS6] = _("UTS namespace Inode");
306 /* Translation Hint: maximum 'LXC' = 8 + */
307    Head_nlstab[EU_LXC] = _("LXC");
308    Desc_nlstab[EU_LXC] = _("LXC container name");
309 /* Translation Hint: maximum 'RSan' = 6 */
310    Head_nlstab[EU_RZA] = _("RSan");
311    Desc_nlstab[EU_RZA] = _("RES Anonymous (KiB)");
312 /* Translation Hint: maximum 'RSfd' = 6 */
313    Head_nlstab[EU_RZF] = _("RSfd");
314    Desc_nlstab[EU_RZF] = _("RES File-based (KiB)");
315 /* Translation Hint: maximum 'RSlk' = 6 */
316    Head_nlstab[EU_RZL] = _("RSlk");
317    Desc_nlstab[EU_RZL] = _("RES Locked (KiB)");
318 /* Translation Hint: maximum 'RSsh' = 6 */
319    Head_nlstab[EU_RZS] = _("RSsh");
320    Desc_nlstab[EU_RZS] = _("RES Shared (KiB)");
321 /* Translation Hint: maximum 'CGNAME' = variable */
322    Head_nlstab[EU_CGN] = _("CGNAME");
323    Desc_nlstab[EU_CGN] = _("Control Group name");
324 /* Translation Hint: maximum 'NU' = 2 */
325    Head_nlstab[EU_NMA] = _("NU");
326    Desc_nlstab[EU_NMA] = _("Last Used NUMA node");
327 /* Translation Hint: maximum 'LOGID' = 5 + */
328    Head_nlstab[EU_LID] = _("LOGID");
329    Desc_nlstab[EU_LID] = _("Login User Id");
330 /* Translation Hint: maximum 'EXE' = variable */
331    Head_nlstab[EU_EXE] = _("EXE");
332    Desc_nlstab[EU_EXE] = _("Executable Path");
333 /* Translation Hint: With the next 5 fields, notice how an extra space
334                      has been added ahead of one 'KiB' so that they all
335                      align. You need not preserve such alignment. */
336 /* Translation Hint: maximum 'RSS' = 6 */
337    Head_nlstab[EU_RSS] = _("RSS");
338    Desc_nlstab[EU_RSS] = _("Res Mem (smaps), KiB");
339 /* Translation Hint: maximum 'PSS' = 6 */
340    Head_nlstab[EU_PSS] = _("PSS");
341    Desc_nlstab[EU_PSS] = _("Proportion RSS,  KiB");
342 /* Translation Hint: maximum 'PSan' = 6 */
343    Head_nlstab[EU_PZA] = _("PSan");
344    Desc_nlstab[EU_PZA] = _("Proportion Anon, KiB");
345 /* Translation Hint: maximum 'PSfd' = 6 */
346    Head_nlstab[EU_PZF] = _("PSfd");
347    Desc_nlstab[EU_PZF] = _("Proportion File, KiB");
348 /* Translation Hint: maximum 'PSsh' = 6 */
349    Head_nlstab[EU_PZS] = _("PSsh");
350    Desc_nlstab[EU_PZS] = _("Proportion Shrd, KiB");
351 /* Translation Hint: maximum 'USS' = 6 */
352    Head_nlstab[EU_USS] = _("USS");
353    Desc_nlstab[EU_USS] = _("Unique RSS, KiB");
354 /* Translation Hint: maximum 'ioR' = 6 */
355    Head_nlstab[EU_IRB] = _("ioR");
356    Desc_nlstab[EU_IRB] = _("I/O Bytes Read");
357 /* Translation Hint: maximum 'ioRop' = 5 */
358    Head_nlstab[EU_IRO] = _("ioRop");
359    Desc_nlstab[EU_IRO] = _("I/O Read Operations");
360 /* Translation Hint: maximum 'ioW' = 6 */
361    Head_nlstab[EU_IWB] = _("ioW");
362    Desc_nlstab[EU_IWB] = _("I/O Bytes Written");
363 /* Translation Hint: maximum 'ioWop' = 5 */
364    Head_nlstab[EU_IWO] = _("ioWop");
365    Desc_nlstab[EU_IWO] = _("I/O Write Operations");
366 /* Translation Hint: maximum 'AGID' = 5 */
367    Head_nlstab[EU_AGI] = _("AGID");
368    Desc_nlstab[EU_AGI] = _("Autogroup Identifier");
369 /* Translation Hint: maximum 'AGNI' = 4 */
370    Head_nlstab[EU_AGN] = _("AGNI");
371    Desc_nlstab[EU_AGN] = _("Autogroup Nice Value");
372 /* Translation Hint: maximum 'STARTED' = 7 */
373    Head_nlstab[EU_TM3] = _("STARTED");
374    Desc_nlstab[EU_TM3] = _("Start Time from boot");
375 /* Translation Hint: maximum 'ELAPSED' = 7 */
376    Head_nlstab[EU_TM4] = _("ELAPSED");
377    Desc_nlstab[EU_TM4] = _("Elapsed Running Time");
378 /* Translation Hint: maximum '%CUU' = 6 */
379    Head_nlstab[EU_CUU] = _("%CUU");
380    Desc_nlstab[EU_CUU] = _("CPU Utilization");
381 /* Translation Hint: maximum '%CUC' = 7 */
382    Head_nlstab[EU_CUC] = _("%CUC");
383    Desc_nlstab[EU_CUC] = _("Utilization + child");
384 /* Translation Hint: maximum 'nsCGROUP' = 10 + */
385    Head_nlstab[EU_NS7] = _("nsCGROUP");
386    Desc_nlstab[EU_NS7] = _("CGRP namespace Inode");
387 /* Translation Hint: maximum 'nsTIME' = 10 + */
388    Head_nlstab[EU_NS8] = _("nsTIME");
389    Desc_nlstab[EU_NS8] = _("TIME namespace Inode");
390 }
391
392
393         /*
394          * This routine builds the nls table containing both plain text
395          * and regular c-format strings. */
396 static void build_norm_nlstab (void) {
397
398 /* Translation Notes ------------------------------------------------
399    .  It is strongly recommend that the --no-wrap command line option
400    .  be used with all supporting translation tools, when available.
401    .
402    .  This group of lines contains both plain text and c-format strings.
403    .
404    .  Some strings reflect switches used to affect the running program
405    .  and should not be translated without also making corresponding
406    .  c-code logic changes.
407    . */
408
409    Norm_nlstab[EXIT_signals_fmt] = _(""
410       "\tsignal %d (%s) was caught by %s, please\n"
411       "\tsend bug reports to <procps@freelists.org>\n");
412    Norm_nlstab[WRONG_switch_fmt] = _(""
413       "inappropriate '%s'\n"
414       "Usage:\n  %s%s");
415    Norm_nlstab[HELP_cmdline_fmt] = _X("\n"
416       "Usage:\n"
417       " %s [options]\n"
418       "\n"
419       "Options:\n"
420       " -b, --batch-mode                run in non-interactive batch mode\n"
421       " -c, --cmdline-toggle            reverse last remembered 'c' state\n"
422       " -d, --delay =SECS [.TENTHS]     iterative delay as SECS [.TENTHS]\n"
423       " -E, --scale-summary-mem =SCALE  set mem as: k,m,g,t,p,e for SCALE\n"
424       " -e, --scale-task-mem =SCALE     set mem with: k,m,g,t,p for SCALE\n"
425       " -H, --threads-show              show tasks plus all their threads\n"
426       " -i, --idle-toggle               reverse last remembered 'i' state\n"
427       " -n, --iterations =NUMBER        exit on maximum iterations NUMBER\n"
428       " -O, --list-fields               output all field names, then exit\n"
429       " -o, --sort-override =FIELD      force sorting on this named FIELD\n"
430       " -p, --pid =PIDLIST              monitor only the tasks in PIDLIST\n"
431       " -S, --accum-time-toggle         reverse last remembered 'S' state\n"
432       " -s, --secure-mode               run with secure mode restrictions\n"
433       " -U, --filter-any-user =USER     show only processes owned by USER\n"
434       " -u, --filter-only-euser =USER   show only processes owned by USER\n"
435       " -w, --width [=COLUMNS]          change print width [,use COLUMNS]\n"
436       " -1, --single-cpu-toggle         reverse last remembered '1' state\n"
437       "\n"
438       " -h, --help                      display this help text, then exit\n"
439       " -V, --version                   output version information & exit\n"
440       "\n"
441       "For more details see top(1).");
442    Norm_nlstab[BAD_delayint_fmt] = _("bad delay interval '%s'");
443    Norm_nlstab[BAD_niterate_fmt] = _("bad iterations argument '%s'");
444    Norm_nlstab[LIMIT_exceed_fmt] = _("pid limit (%d) exceeded");
445    Norm_nlstab[BAD_mon_pids_fmt] = _("bad pid '%s'");
446    Norm_nlstab[MISSING_args_fmt] = _("-%c argument missing");
447    Norm_nlstab[BAD_widtharg_fmt] = _("bad width arg '%s'");
448    Norm_nlstab[UNKNOWN_opts_fmt] = _("unknown option '%s'");
449    Norm_nlstab[DELAY_secure_txt] = _("-d disallowed in \"secure\" mode");
450    Norm_nlstab[DELAY_badarg_txt] = _("-d requires positive argument");
451    Norm_nlstab[ON_word_only_txt] = _("On");
452    Norm_nlstab[OFF_one_word_txt] = _("Off");
453    Norm_nlstab[VERSION_opts_fmt] = _("%s from %s");
454    Norm_nlstab[FOREST_modes_fmt] = _("Forest mode %s");
455    Norm_nlstab[FAIL_tty_get_txt] = _("failed tty get");
456    Norm_nlstab[FAIL_tty_set_fmt] = _("failed tty set: %s");
457    Norm_nlstab[CHOOSE_group_txt] = _("Choose field group (1 - 4)");
458    Norm_nlstab[DISABLED_cmd_txt] = _("Command disabled, 'A' mode required");
459    Norm_nlstab[DISABLED_win_fmt] = _("Command disabled, activate %s with '-' or '_'");
460    Norm_nlstab[COLORS_nomap_txt] = _("No colors to map!");
461    Norm_nlstab[FAIL_rc_open_fmt] = _("Failed '%s' open: %s");
462    Norm_nlstab[WRITE_rcfile_fmt] = _("Wrote configuration to '%s'");
463    Norm_nlstab[DELAY_change_fmt] = _("Change delay from %.1f to");
464    Norm_nlstab[THREADS_show_fmt] = _("Show threads %s");
465    Norm_nlstab[IRIX_curmode_fmt] = _("Irix mode %s");
466    Norm_nlstab[GET_pid2kill_fmt] = _("PID to signal/kill [default pid = %d]");
467    Norm_nlstab[GET_sigs_num_fmt] = _("Send pid %d signal [%d/sigterm]");
468    Norm_nlstab[FAIL_signals_fmt] = _("Failed signal pid '%d' with '%d': %s");
469    Norm_nlstab[BAD_signalid_txt] = _("Invalid signal");
470    Norm_nlstab[GET_pid2nice_fmt] = _("PID to renice [default pid = %d]");
471    Norm_nlstab[GET_nice_num_fmt] = _("Renice PID %d to value");
472    Norm_nlstab[FAIL_re_nice_fmt] = _("Failed renice of PID %d to %d: %s");
473    Norm_nlstab[NAME_windows_fmt] = _("Rename window '%s' to (1-3 chars)");
474    Norm_nlstab[TIME_accumed_fmt] = _("Cumulative time %s");
475    Norm_nlstab[GET_max_task_fmt] = _("Maximum tasks = %d, change to (0 is unlimited)");
476    Norm_nlstab[BAD_max_task_txt] = _("Invalid maximum");
477    Norm_nlstab[GET_user_ids_txt] = _("Which user (blank for all)");
478    Norm_nlstab[UNKNOWN_cmds_txt] = _("Unknown command - try 'h' for help");
479    Norm_nlstab[SCROLL_coord_fmt] = _("scroll coordinates: y = %d/%d (tasks), x = %d/%d (fields)");
480    Norm_nlstab[FAIL_alloc_c_txt] = _("failed memory allocate");
481    Norm_nlstab[FAIL_alloc_r_txt] = _("failed memory re-allocate");
482    Norm_nlstab[BAD_numfloat_txt] = _("Unacceptable floating point");
483    Norm_nlstab[BAD_username_txt] = _("Invalid user");
484    Norm_nlstab[FOREST_views_txt] = _("forest view");
485    Norm_nlstab[FAIL_widepid_txt] = _("failed pid maximum size test");
486    Norm_nlstab[FAIL_widecpu_txt] = _("failed number of cpus test");
487    Norm_nlstab[RC_bad_files_fmt] = _("incompatible rcfile, you should delete '%s'");
488    Norm_nlstab[RC_bad_entry_fmt] = _("window entry #%d corrupt, please delete '%s'");
489    Norm_nlstab[NOT_onsecure_txt] = _("Unavailable in secure mode");
490    Norm_nlstab[NOT_smp_cpus_txt] = _("Only 1 cpu detected");
491    Norm_nlstab[BAD_integers_txt] = _("Unacceptable integer");
492    Norm_nlstab[SELECT_clash_txt] = _("conflicting process selections (U/p/u)");
493 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
494    .                 kibibytes (1024 bytes) */
495    Norm_nlstab[AMT_kilobyte_txt] = _("KiB");
496 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
497    .                 mebibytes (1,048,576 bytes) */
498    Norm_nlstab[AMT_megabyte_txt] = _("MiB");
499 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
500    .                 gibibytes (1,073,741,824 bytes) */
501    Norm_nlstab[AMT_gigabyte_txt] = _("GiB");
502 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
503    .                 tebibytes (1,099,511,627,776 bytes) */
504    Norm_nlstab[AMT_terabyte_txt] = _("TiB");
505 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
506    .                 pebibytes (1,024 tebibytes) */
507    Norm_nlstab[AMT_petabyte_txt] = _("PiB");
508 /* Translation Hint: This is an abbreviation (limit 3 characters) for:
509    .                 exbibytes (1,024 pebibytes) */
510    Norm_nlstab[AMT_exxabyte_txt] = _("EiB");
511    Norm_nlstab[WORD_threads_txt] = _("Threads");
512    Norm_nlstab[WORD_process_txt] = _("Tasks");
513 /* Translation Hint: The following "word" is meant to represent either a single
514    .                 cpu or all of the processors in a multi-processor computer
515    .                 (should be exactly 6 characters, excluding leading % & colon) */
516    Norm_nlstab[WORD_allcpus_txt] = _("%Cpu(s):");
517 /* Translation Hint: The following "word" is meant to represent a single processor
518                      and 'the Cp' prefix will be combined with a  core id: 'p', 'e' or 'u'
519    .                 (if 'Cp' is translated, it must be exactly 2 characters long) */
520    Norm_nlstab[WORD_eachcpu_fmt] = _("%%Cp%c%-3d:");
521 /* Translation Hint: The following word "another" must have 1 trailing space */
522    Norm_nlstab[WORD_another_txt] = _("another ");
523    Norm_nlstab[FIND_no_next_txt] = _("Locate next inactive, use \"L\"");
524    Norm_nlstab[GET_find_str_txt] = _("Locate string");
525    Norm_nlstab[FIND_no_find_fmt] = _("%s\"%s\" not found");
526    Norm_nlstab[XTRA_fixwide_fmt] = _("width incr is %d, change to (0 default, -1 auto)");
527    Norm_nlstab[XTRA_warncfg_txt] = _("rcfile has inspect/other-filter error(s), save anyway?");
528    Norm_nlstab[XTRA_badflds_fmt] = _("unrecognized field name '%s'");
529    Norm_nlstab[XTRA_winsize_txt] = _("even using field names only, window is now too small");
530    Norm_nlstab[YINSP_demo01_txt] = _("Open Files");
531    Norm_nlstab[YINSP_demo02_txt] = _("NUMA Info");
532    Norm_nlstab[YINSP_demo03_txt] = _("Log");
533    Norm_nlstab[YINSP_deqfmt_txt] = _("the '=' key will eventually show the actual file read or command(s) executed ...");
534    Norm_nlstab[YINSP_deqtyp_txt] = _("demo");
535    Norm_nlstab[YINSP_dstory_txt] = _(""
536       "This is simulated output representing the contents of some file or the output\n"
537       "from some command.  Exactly which commands and/or files are solely up to you.\n"
538       "\n"
539       "Although this text is for information purposes only, it can still be scrolled\n"
540       "and searched like real output will be.  You are encouraged to experiment with\n"
541       "those features as explained in the prologue above.\n"
542       "\n"
543       "To enable real Inspect functionality, entries must be added to the end of the\n"
544       "top personal personal configuration file.  You could use your favorite editor\n"
545       "to accomplish this, taking care not to disturb existing entries.\n"
546       "\n"
547       "Another way to add entries is illustrated below, but it risks overwriting the\n"
548       "rcfile.  Redirected echoes must not replace (>) but append (>>) to that file.\n"
549       "\n"
550       "  /bin/echo -e \"pipe\\tOpen Files\\tlsof -P -p %d 2>&1\" >> ~/.toprc\n"
551       "  /bin/echo -e \"file\\tNUMA Info\\t/proc/%d/numa_maps\" >> ~/.toprc\n"
552       "  /bin/echo -e \"pipe\\tLog\\ttail -n200 /var/log/syslog | sort -Mr\" >> ~/.toprc\n"
553       "\n"
554       "If you don't know the location or name of the top rcfile, use the 'W' command\n"
555       "and note those details.  After backing up the current rcfile, try issuing the\n"
556       "above echoes exactly as shown, replacing '.toprc' as appropriate.  The safest\n"
557       "approach would be to use copy then paste to avoid any typing mistakes.\n"
558       "\n"
559       "Finally, restart top to reveal what actual Inspect entries combined with this\n"
560       "new command can offer.  The possibilities are endless, especially considering\n"
561       "that 'pipe' type entries can include shell scripts too!\n"
562       "\n"
563       "For additional important information, please consult the top(1) man document.\n"
564       "Then, enhance top with your very own customized 'file' and/or 'pipe' entries.\n"
565       "\n"
566       "Enjoy!\n");
567    Norm_nlstab[YINSP_noent1_txt] = _("to enable 'Y' press <Enter> then type 'W' and restart top");
568    Norm_nlstab[YINSP_noent2_txt] = _("to enable 'Y' please consult the top man page (press Enter)");
569    Norm_nlstab[YINSP_failed_fmt] = _("Selection failed with: %s\n");
570    Norm_nlstab[YINSP_pidbad_fmt] = _("unable to inspect, pid %d not found");
571    Norm_nlstab[YINSP_pidsee_fmt] = _("inspect at PID [default pid = %d]");
572    Norm_nlstab[YINSP_status_fmt] = _("%s: %*d-%-*d lines, %*d-%*d columns, %lu bytes read");
573    Norm_nlstab[YINSP_waitin_txt] = _("patience please, working ...");
574    Norm_nlstab[YINSP_workin_txt] = _("working, use Ctrl-C to end ...");
575 /* Translation Hint: Below are 2 abbreviations which can be as long as needed:
576    .                 FLD = FIELD, VAL = VALUE */
577    Norm_nlstab[OSEL_prompts_fmt] = _("add filter #%d (%s) as: [!]FLD?VAL");
578    Norm_nlstab[OSEL_casenot_txt] = _("ignoring case");
579    Norm_nlstab[OSEL_caseyes_txt] = _("case sensitive");
580    Norm_nlstab[OSEL_errdups_txt] = _("duplicate filter was ignored");
581    Norm_nlstab[OSEL_errdelm_fmt] = _("'%s' filter delimiter is missing");
582    Norm_nlstab[OSEL_errvalu_fmt] = _("'%s' filter value is missing");
583    Norm_nlstab[WORD_include_txt] = _("include");
584    Norm_nlstab[WORD_exclude_txt] = _("exclude");
585    Norm_nlstab[OSEL_statlin_fmt] = _("<Enter> to resume, filters: %s");
586    Norm_nlstab[WORD_noneone_txt] = _("none");
587 /* Translation Hint: The following word 'Node' should be exactly
588                      4 characters, excluding leading %%, fmt chars & colon) */
589    Norm_nlstab[NUMA_nodenam_fmt] = _("%%Node%-2d:");
590    Norm_nlstab[NUMA_nodeget_fmt] = _("expand which numa node (0-%d)");
591    Norm_nlstab[NUMA_nodebad_txt] = _("invalid numa node");
592    Norm_nlstab[NUMA_nodenot_txt] = _("sorry, NUMA extensions unavailable");
593 /* Translation Hint: 'Mem ' is an abbreviation for physical memory/ram
594    .                 'Swap' represents the linux swap file --
595    .                 please make both translations exactly 4 characters,
596    .                 padding with extra spaces as necessary */
597    Norm_nlstab[WORD_abv_mem_txt] = _("Mem ");
598    Norm_nlstab[WORD_abv_swp_txt] = _("Swap");
599    Norm_nlstab[LIB_errormem_fmt] = _("library failed memory statistics, at %d: %s");
600    Norm_nlstab[LIB_errorcpu_fmt] = _("library failed cpu statistics, at %d: %s");
601    Norm_nlstab[LIB_errorpid_fmt] = _("library failed pids statistics, at %d: %s");
602    Norm_nlstab[BAD_memscale_fmt] = _("bad memory scaling arg '%s'");
603    Norm_nlstab[XTRA_vforest_fmt] = _("PID to collapse/expand [default pid = %d]");
604    Norm_nlstab[XTRA_modebad_txt] = _("wrong mode, command inactive");
605    Norm_nlstab[XTRA_warnold_txt] = _("saving prevents older top from reading, save anyway?");
606    Norm_nlstab[X_SEMAPHORES_fmt] = _("failed sem_init() at %d: %s");
607    Norm_nlstab[X_THREADINGS_fmt] = _("failed pthread_create() at %d: %s");
608    Norm_nlstab[X_RESTRICTED_txt] = _("sorry, restricted namespace with reduced functionality");
609    Norm_nlstab[AGNI_valueof_fmt] = _("set pid %d AGNI value to");
610    Norm_nlstab[AGNI_invalid_txt] = _("valid AGNI range is -20 to +19");
611    Norm_nlstab[AGNI_notopen_fmt] = _("autogroup open failed, %s");
612    Norm_nlstab[AGNI_nowrite_fmt] = _("autogroup write failed, %s");
613    Norm_nlstab[X_BOT_cmdlin_fmt] = _("command line for pid %d, %s");
614    Norm_nlstab[X_BOT_ctlgrp_fmt] = _("control groups for pid %d, %s");
615    Norm_nlstab[X_BOT_envirn_fmt] = _("environment for pid %d, %s");
616    Norm_nlstab[X_BOT_namesp_fmt] = _("namespaces for pid %d, %s");
617    Norm_nlstab[X_BOT_nodata_txt] = _("n/a");
618    Norm_nlstab[X_BOT_supgrp_fmt] = _("supplementary groups for pid %d, %s");
619    Norm_nlstab[X_BOT_msglog_txt] = _("message log, last 10 messages:");
620 }
621
622
623         /*
624          * This routine builds the nls table containing specially
625          * formatted strings designed to fit within an 80x24 terminal. */
626 static void build_uniq_nlstab (void) {
627
628 /* Translation Notes ------------------------------------------------
629    .  It is strongly recommend that the --no-wrap command line option
630    .  be used with all supporting translation tools, when available.
631    .
632    .  The next several text groups contain special escape sequences
633    .  representing values used to index a table at run-time.
634    .
635    .  Each such sequence consists of a tilde (~) followed by an ascii
636    .  number in the range of '1' - '8'.  Examples are '~2', '~8', etc.
637    .  These escape sequences must never themselves be translated but
638    .  could be deleted.
639    .
640    .  If you remove these escape sequences (both tilde and number) it
641    .  would make translation easier.  However, the ability to display
642    .  colors and bold text at run-time will have been lost.
643    .
644    .  Additionally, each of these text groups was designed to display
645    .  in a 80x24 terminal window.  Hopefully, any translations will
646    .  adhere to that goal lest the translated text be truncated.
647    .
648    .  If you would like additional information regarding these strings,
649    .  please see the prologue to the show_special function in the top.c
650    .  source file.
651    .
652    .  Caution:
653    .    The next three items represent pages for interacting with a user.
654    .    In all cases, the last lines of text must be treated with care.
655    .
656    .    They must not end with a newline character so that at runtime the
657    .    cursor will remain on that final text line.
658    .
659    .    Also, the special sequences (tilde+number) must not appear on the
660    .    last line (the one without the newline). So please avoid any line
661    .    wraps that could place them there.
662    . */
663
664    Uniq_nlstab[KEYS_helpbas_fmt] = _(""
665       "Help for Interactive Commands~2 - %s\n"
666       "Window ~1%s~6: ~1Cumulative mode ~3%s~2.  ~1System~6: ~1Delay ~3%.1f secs~2; ~1Secure mode ~3%s~2.\n"
667       "\n"
668       "  Z~5,~1B~5,E,e   Global: '~1Z~2' colors; '~1B~2' bold; '~1E~2'/'~1e~2' summary/task memory scale\n"
669       "  l,t,m,I   Toggle: '~1l~2' load avg; '~1t~2' task/cpu; '~1m~2' memory; '~1I~2' Irix mode\n"
670       "  0,1,2,3,4 Toggle: '~10~2' zeros; '~11~2/~12~2/~13~2' cpu/numa views; '~14~2' cpus two abreast\n"
671       "  f,X       Fields: '~1f~2' add/remove/order/sort; '~1X~2' increase fixed-width fields\n"
672       "\n"
673       "  L,&,<,> . Locate: '~1L~2'/'~1&~2' find/again; Move sort column: '~1<~2'/'~1>~2' left/right\n"
674       "  R,H,J,C . Toggle: '~1R~2' Sort; '~1H~2' Threads; '~1J~2' Num justify; '~1C~2' Coordinates\n"
675       "  c,i,S,j . Toggle: '~1c~2' Cmd name/line; '~1i~2' Idle; '~1S~2' Time; '~1j~2' Str justify\n"
676       "  x~5,~1y~5     . Toggle highlights: '~1x~2' sort field; '~1y~2' running tasks\n"
677       "  z~5,~1b~5     . Toggle: '~1z~2' color/mono; '~1b~2' bold/reverse (only if 'x' or 'y')\n"
678       "  u,U,o,O . Filter by: '~1u~2'/'~1U~2' effective/any user; '~1o~2'/'~1O~2' other criteria\n"
679       "  n,#,^O  . Set: '~1n~2'/'~1#~2' max tasks displayed; Show: ~1Ctrl~2+'~1O~2' other filter(s)\n"
680       "  V,v,F   . Toggle: '~1V~2' forest view; '~1v~2' hide/show children; '~1F~2' keep focused\n"
681       "\n"
682       "%s"
683       "  ^G,K,N,U  View: ctl groups ~1^G~2; cmdline ~1^K~2; environment ~1^N~2; supp groups ~1^U~2\n"
684       "  W,Y,!,^E  Write cfg '~1W~2'; Inspect '~1Y~2'; Combine Cpus '~1!~2'; Scale time ~1^E~2'\n"
685       "  q         Quit\n"
686       "          ( commands shown with '.' require a ~1visible~2 task display ~1window~2 ) \n"
687       "Press '~1h~2' or '~1?~2' for help with ~1Windows~2,\n"
688       "Type 'q' or <Esc> to continue ");
689
690    Uniq_nlstab[WINDOWS_help_fmt] = _(""
691       "Help for Windows / Field Groups~2 - \"Current Window\" = ~1 %s ~6\n"
692       "\n"
693       ". Use multiple ~1windows~2, each with separate config opts (color,fields,sort,etc)\n"
694       ". The 'current' window controls the ~1Summary Area~2 and responds to your ~1Commands~2\n"
695       "  . that window's ~1task display~2 can be turned ~1Off~2 & ~1On~2, growing/shrinking others\n"
696       "  . with ~1NO~2 task display, some commands will be ~1disabled~2 ('i','R','n','c', etc)\n"
697       "    until a ~1different window~2 has been activated, making it the 'current' window\n"
698       ". You ~1change~2 the 'current' window by: ~1 1~2) cycling forward/backward;~1 2~2) choosing\n"
699       "  a specific field group; or~1 3~2) exiting the color mapping or fields screens\n"
700       ". Commands ~1available anytime   -------------~2\n"
701       "    A       . Alternate display mode toggle, show ~1Single~2 / ~1Multiple~2 windows\n"
702       "    g       . Choose another field group and make it 'current', or change now\n"
703       "              by selecting a number from: ~1 1~2 =%s;~1 2~2 =%s;~1 3~2 =%s; or~1 4~2 =%s\n"
704       ". Commands ~1requiring~2 '~1A~2' mode~1  -------------~2\n"
705       "    G       . Change the ~1Name~5 of the 'current' window/field group\n"
706       " ~1*~4  a , w   . Cycle through all four windows:  '~1a~5' Forward; '~1w~5' Backward\n"
707       " ~1*~4  - , _   . Show/Hide:  '~1-~5' ~1Current~2 window; '~1_~5' all ~1Visible~2/~1Invisible~2\n"
708       "  The screen will be divided evenly between task displays.  But you can make\n"
709       "  some ~1larger~2 or ~1smaller~2, using '~1n~2' and '~1i~2' commands.  Then later you could:\n"
710       " ~1*~4  = , +   . Rebalance tasks:  '~1=~5' ~1Current~2 window; '~1+~5' ~1Every~2 window\n"
711       "              (this also forces the ~1current~2 or ~1every~2 window to become visible)\n"
712       "\n"
713       "In '~1A~2' mode, '~1*~4' keys are your ~1essential~2 commands.  Please try the '~1a~2' and '~1w~2'\n"
714       "commands plus the 'g' sub-commands NOW.  Press <Enter> to make 'Current' ");
715
716 /* Translation Notes ------------------------------------------------
717    .  The following 'Help for color mapping' simulated screen should
718    .  probably NOT be translated.  It is terribly hard to follow in
719    .  this form and any translation could produce unpleasing results
720    .  that are unlikely to parallel the running top program.
721    .
722    .  If you decide to proceed with translation, please take care
723    .  to not disturb the spaces and the tilde + number delimiters.
724    . */
725    Uniq_nlstab[COLOR_custom_fmt] = _(""
726       "Help for color mapping~2 - \"Current Window\" = ~1 %s ~6\n"
727       "\n"
728       "   color - 04:25:44 up 8 days, 50 min,  7 users,  load average:\n"
729       "   Tasks:~3  64 ~2total,~3   2 ~3running,~3  62 ~2sleeping,~3   0 ~2stopped,~3\n"
730       "   %%Cpu(s):~3  76.5 ~2user,~3  11.2 ~2system,~3   0.0 ~2nice,~3  12.3 ~2idle~3\n"
731       "   ~1 Nasty Message! ~4  -or-  ~1Input Prompt~5\n"
732       "   ~1  PID TTY     PR  NI %%CPU    TIME+   VIRT SWAP S COMMAND    ~6\n"
733       "   17284 ~8pts/2  ~7  8   0  0.0   0:00.75  1380    0 S /bin/bash   ~8\n"
734       "   ~1 8601 pts/1    7 -10  0.4   0:00.03   916    0 R color -b -z~7\n"
735       "   11005 ~8?      ~7  9   0  0.0   0:02.50  2852 1008 S amor -sessi~8\n"
736       "   available toggles: ~1B~2 =disable bold globally (~1%s~2),\n"
737       "       ~1z~2 =color/mono (~1%s~2), ~1b~2 =tasks \"bold\"/reverse (~1%s~2)\n"
738       "\n"
739       "1) Select a ~1target~2 as an upper case letter, ~1current target~2 is ~1 %c ~4:\n"
740       "   S~2 = Summary Data,~1  M~2 = Messages/Prompts,\n"
741       "   H~2 = Column Heads,~1  T~2 = Task Information\n"
742       "2) Select a ~1color~2 as a number or use the up/down arrow keys\n"
743       "   to raise/lower the %d colors value, ~1current color~2 is ~1 %d ~4:\n"
744       "   0~2 = black,~1  1~2 = red,    ~1  2~2 = green,~1  3~2 = yellow,\n"
745       "   4~2 = blue, ~1  5~2 = magenta,~1  6~2 = cyan, ~1  7~2 = white\n"
746       "\n"
747       "3) Then use these keys when finished:\n"
748       "   'q' or <Esc> to abort changes to window '~1%s~2'\n"
749       "   'a' or 'w' to commit & change another, <Enter> to commit and end ");
750
751 /* Translation Hint: As is true for the text above, the "keys" shown to the left and
752    .                 also imbedded in the translatable text (along with escape seqs)
753    .                 should never themselves be translated. */
754    Uniq_nlstab[KEYS_helpext_fmt] = _(""
755       "  d,k,r,^R '~1d~2' set delay; '~1k~2' kill; '~1r~2' renice; ~1Ctrl~2+'~1R~2' renice autogroup\n");
756
757 /* Translation Hint:
758    .  This Fields Management header should be 3 lines long so as
759    .  to allow 1 blank line before the fields & descriptions.
760    .  If absoultely necessary, 4 lines could be used (but never more).
761    . */
762    Uniq_nlstab[FIELD_header_fmt] = _(""
763       "Fields Management~2 for window ~1%s~6, whose current sort field is ~1%s~2\n"
764       "   Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,\n"
765       "   'd' or <Space> toggles display, 's' sets sort.  Use 'q' or <Esc> to end!\n");
766
767 /* Translation Hint:
768    .  The next 5 items must each be translated as a single line.
769    . */
770    Uniq_nlstab[STATE_line_1_fmt] = _("%s:~3"
771       " %3u ~2total,~3 %3u ~2running,~3 %3u ~2sleeping,~3 %3u ~2stopped,~3 %3u ~2zombie~3\n");
772
773 /* Translation Hint: Only the following abbreviations need be translated
774    .                 us = user, sy = system, ni = nice, id = idle, wa = wait,
775    .                 hi hardware interrupt, si = software interrupt */
776    Uniq_nlstab[STATE_lin2x6_fmt] = _("%s~3"
777       " %#5.1f ~2us,~3 %#5.1f ~2sy,~3 %#5.1f ~2ni,~3 %#5.1f ~2id,~3 %#5.1f ~2wa,~3 %#5.1f ~2hi,~3 %#5.1f ~2si~3 ~1");
778
779 /* Translation Hint: Only the following abbreviations need be translated
780    .                 us = user, sy = system, ni = nice, id = idle, wa = wait,
781    .                 hi hardware interrupt, si = software interrupt, st = steal time */
782    Uniq_nlstab[STATE_lin2x7_fmt] = _("%s~3"
783       "%#5.1f ~2us,~3%#5.1f ~2sy,~3%#5.1f ~2ni,~3%#5.1f ~2id,~3%#5.1f ~2wa,~3%#5.1f ~2hi,~3%#5.1f ~2si,~3%#5.1f ~2st~3 ~1");
784
785 /* Translation Hint: next 2 must be treated together, with WORDS above & below aligned */
786    Uniq_nlstab[MEMORY_line1_fmt] = _(""
787       "%s %s:~3 %9.9s~2total,~3 %9.9s~2free,~3 %9.9s~2used,~3 %9.9s~2buff/cache~3 ~1    ");
788    Uniq_nlstab[MEMORY_line2_fmt] = _(""
789       "%s %s:~3 %9.9s~2total,~3 %9.9s~2free,~3 %9.9s~2used.~3 %9.9s~2avail %s~3");
790
791 /* Translation Hint:
792    .  The next 2 headers for 'Inspection' must each be 3 lines or less
793    . */
794    Uniq_nlstab[YINSP_hdsels_fmt] = _(""
795       "Inspection~2 Pause at: pid ~1%d~6, running ~1%s~6\n"
796       "Use~2:  left/right then <Enter> to ~1select~5 an option; 'q' or <Esc> to ~1end~5 !\n"
797       "Options~2: ~1%s\n");
798
799    Uniq_nlstab[YINSP_hdview_fmt] = _(""
800       "Inspection~2 View at pid: ~1%s~3, running ~1%s~3.  Locating: ~1%s~6\n"
801       "Use~2:  left/right/up/down/etc to ~1navigate~5 the output; 'L'/'&' to ~1locate~5/~1next~5.\n"
802       "Or~2:   <Enter> to ~1select another~5; 'q' or <Esc> to ~1end~5 !\n");
803 }
804
805
806         /*
807          * This function must be called very early at startup, before
808          * any other function call, and especially before any changes
809          * have been made to the terminal if NLS_VALIDATE is defined!
810          *
811          * The gettext documentation suggests that alone among locale
812          * variables LANGUAGE=ll_CC may be abbreviated as LANGUAGE=ll
813          * to denote the language's main dialect.  Unfortunately this
814          * does not appear to be true.  One must specify the complete
815          * ll_CC.  Optionally, a '.UTF-8' or '.uft8' suffix, as shown
816          * in the following examples, may also be included:
817          *    export LANGUAGE=ll_CC          # minimal requirement
818          *    export LANGUAGE=ll_CC.UTF-8    # optional convention
819          *    export LANGUAGE=ll_CC.utf8     # ok, too
820          *
821          * Additionally, as suggested in the gettext documentation, a
822          * user will also have to export an empty LC_ALL= to actually
823          * enable any translations.
824          */
825 void initialize_nls (void) {
826 #ifdef NLS_VALIDATE
827    static const char *nls_err ="\t%s_nlstab[%d] == NULL\n";
828    int i;
829
830    setlocale (LC_ALL, "");
831    bindtextdomain(PACKAGE, LOCALEDIR);
832    textdomain(PACKAGE);
833
834    memset(Head_nlstab, 0, sizeof(Head_nlstab));
835    memset(Desc_nlstab, 0, sizeof(Desc_nlstab));
836    build_two_nlstabs();
837    for (i = 0; i < EU_MAXPFLGS; i++) {
838       if (!Head_nlstab[i]) {
839          fprintf(stderr, nls_err, "Head", i);
840          exit(1);
841       }
842       if (!Desc_nlstab[i]) {
843          fprintf(stderr, nls_err, "Desc", i);
844          exit(1);
845       }
846    }
847    memset(Norm_nlstab, 0, sizeof(Norm_nlstab));
848    build_norm_nlstab();
849    for (i = 0; i < norm_MAX; i++)
850       if (!Norm_nlstab[i]) {
851          fprintf(stderr, nls_err, "Norm", i);
852          exit(1);
853       }
854    memset(Uniq_nlstab, 0, sizeof(Uniq_nlstab));
855    build_uniq_nlstab();
856    for (i = 0; i < uniq_MAX; i++)
857       if (!Uniq_nlstab[i]) {
858          fprintf(stderr, nls_err, "Uniq", i);
859          exit(1);
860       }
861 #else
862    setlocale (LC_ALL, "");
863    bindtextdomain(PACKAGE, LOCALEDIR);
864    textdomain(PACKAGE);
865
866    build_two_nlstabs();
867    build_norm_nlstab();
868    build_uniq_nlstab();
869 #endif
870 }