From 20859f6fa6be49df053f06b7ce954890ae3affd7 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Fri, 27 May 2022 00:00:00 -0500 Subject: [PATCH] top: the bottom 'window' headings are now translatable Signed-off-by: Jim Warner --- top/top.c | 18 +++++++++--------- top/top.h | 2 +- top/top_nls.c | 5 +++++ top/top_nls.h | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/top/top.c b/top/top.c index 02de8e70..56d785be 100644 --- a/top/top.c +++ b/top/top.c @@ -127,7 +127,7 @@ static int Bot_task, Bot_indx = BOT_UNFOCUS, Bot_item[BOT_MAXIMUM] = { BOT_DELIMIT }; static char Bot_sep, - *Bot_name, + *Bot_head, Bot_buf[BOTBUFSIZ]; // the 'environ' can be huge typedef int(*BOT_f)(const void *, const void *); static BOT_f Bot_focus_func; @@ -5077,7 +5077,7 @@ static void *bot_item_hlp (struct pids_stack *p) { * This guy manages that bottom margin window | * which shows various process related stuff. | */ static void bot_item_show (void) { - #define mkHDR fmtmk("%s for pid %d, %s", Bot_name, Bot_task, PID_VAL(EU_CMD, str, p)) + #define mkHDR fmtmk(Bot_head, Bot_task, PID_VAL(EU_CMD, str, p)) struct pids_stack *p; int i; @@ -5102,7 +5102,7 @@ static void bot_item_show (void) { /* * This guy can toggle between displaying the | * bottom window or arranging to turn it off. | */ -static void bot_item_toggle (int what, const char *name, char sep) { +static void bot_item_toggle (int what, const char *head, char sep) { int i; // if already targeted, assume user wants to turn it off ... @@ -5131,7 +5131,7 @@ static void bot_item_toggle (int what, const char *name, char sep) { Bot_sep = sep; Bot_what = what; Bot_indx = BOT_UNFOCUS; - Bot_name = (char *)name; + Bot_head = (char *)head; Bot_show_func = bot_item_show; Bot_task = PID_VAL(EU_PID, s_int, Curwin->ppt[Curwin->begtask]); } @@ -5515,7 +5515,7 @@ static void keys_global (int ch) { #endif break; case kbd_CtrlG: - bot_item_toggle(EU_CGR, "control groups", BOT_SEP_SLS); + bot_item_toggle(EU_CGR, N_fmt(X_BOT_ctlgrp_fmt), BOT_SEP_SLS); break; case kbd_CtrlI: if (Bot_what) { @@ -5526,14 +5526,14 @@ static void keys_global (int ch) { break; case kbd_CtrlK: // with string vectors, the 'separator' may serve a different purpose - bot_item_toggle(eu_CMDLINE_V, "command line", BOT_SEP_SPC); + bot_item_toggle(eu_CMDLINE_V, N_fmt(X_BOT_cmdlin_fmt), BOT_SEP_SPC); break; case kbd_CtrlN: // with string vectors, the 'separator' may serve a different purpose - bot_item_toggle(eu_ENVIRON_V, "environment", BOT_SEP_SPC); + bot_item_toggle(eu_ENVIRON_V, N_fmt(X_BOT_envirn_fmt), BOT_SEP_SPC); break; case kbd_CtrlP: - bot_item_toggle(BOT_ITEM_NS, "namespaces", BOT_SEP_CMA); + bot_item_toggle(BOT_ITEM_NS, N_fmt(X_BOT_namesp_fmt), BOT_SEP_CMA); break; case kbd_CtrlR: if (Secure_mode) @@ -5562,7 +5562,7 @@ static void keys_global (int ch) { } break; case kbd_CtrlU: - bot_item_toggle(EU_SGN, "supplementary groups", BOT_SEP_CMA); + bot_item_toggle(EU_SGN, N_fmt(X_BOT_supgrp_fmt), BOT_SEP_CMA); break; case kbd_BTAB: if (Bot_what) { diff --git a/top/top.h b/top/top.h index 84a6daae..ef0ce188 100644 --- a/top/top.h +++ b/top/top.h @@ -746,7 +746,7 @@ typedef struct WIN_t { //atic int bot_focus_strv (const char *hdr, const char **strv); //atic void *bot_item_hlp (struct pids_stack *p); //atic void bot_item_show (void); -//atic void bot_item_toggle (int what, const char *name, char sep); +//atic void bot_item_toggle (int what, const char *head, char sep); /*------ Interactive Input Tertiary support ----------------------------*/ //atic inline int find_ofs (const WIN_t *q, const char *buf); //atic void find_string (int ch); diff --git a/top/top_nls.c b/top/top_nls.c index 3a144f89..668836aa 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -591,6 +591,11 @@ static void build_norm_nlstab (void) { Norm_nlstab[AGNI_invalid_txt] = _("valid AGNI range is -20 to +19"); Norm_nlstab[AGNI_notopen_fmt] = _("autogroup open failed, %s"); Norm_nlstab[AGNI_nowrite_fmt] = _("autogroup write failed, %s"); + Norm_nlstab[X_BOT_cmdlin_fmt] = _("command line for pid %d, %s"); + 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_supgrp_fmt] = _("supplementary groups for pid %d, %s"); } diff --git a/top/top_nls.h b/top/top_nls.h index 8201f0bb..73e6c716 100644 --- a/top/top_nls.h +++ b/top/top_nls.h @@ -85,7 +85,8 @@ enum norm_nls { WORD_process_txt, WORD_threads_txt, WRITE_rcfile_fmt, WRONG_switch_fmt, 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_RESTRICTED_txt, X_SEMAPHORES_fmt, X_THREADINGS_fmt, + X_BOT_cmdlin_fmt, X_BOT_ctlgrp_fmt, X_BOT_envirn_fmt, X_BOT_namesp_fmt, + 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,