From c465dca573178ee19e5c0ed89d82a3c50a318930 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 20 Dec 2011 14:43:54 -0600 Subject: [PATCH] top: adapt 'locate/find next' search capability for nls --- top/top.c | 8 ++++---- top/top_nls.c | 7 ++++++- top/top_nls.h | 17 +++++++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/top/top.c b/top/top.c index 4604fa43..e224dc25 100644 --- a/top/top.c +++ b/top/top.c @@ -2698,18 +2698,18 @@ static void file_writerc (void) { static void find_string (int ch) { - #define reDUX (found) ? "another " : "" + #define reDUX (found) ? N_txt(WORD_another_txt) : "" static char str[SCREENMAX]; static int found; char buf[ROWMINSIZ]; int i; if ('&' == ch && !str[0]) { - show_msg("Locate next inactive, use \"L\""); + show_msg(N_txt(FIND_no_next_txt)); return; } if ('L' == ch) { - strcpy(str, linein("Locate string")); + strcpy(str, linein(N_txt(GET_find_str_txt))); found = 0; } if (str[0]) { @@ -2722,7 +2722,7 @@ static void find_string (int ch) { return; } } - show_msg(fmtmk("%s\"%s\" not found", reDUX, str)); + show_msg(fmtmk(N_fmt(FIND_no_find_fmt), reDUX, str)); } #undef reDUX } // end: find_string diff --git a/top/top_nls.c b/top/top_nls.c index 3da3d4b7..43c76fa6 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -255,6 +255,11 @@ static void build_norm_nlstab (void) { /* Translation Hint: The following "word" is meant to represent a single processor . (should be exactly 3 characters) */ Norm_nlstab[WORD_eachcpu_fmt] = _("Cpu%-3d:"); +/* Translation Hint: The following word "another" must have 1 trailing space */ + Norm_nlstab[WORD_another_txt] = _("another "); + Norm_nlstab[FIND_no_next_txt] = _("Locate next inactive, use \"L\""); + Norm_nlstab[GET_find_str_txt] = _("Locate string"); + Norm_nlstab[FIND_no_find_fmt] = _("%s\"%s\" not found"); } @@ -297,7 +302,7 @@ static void build_uniq_nlstab (void) { " 1,I Toggle SMP view: '~11~2' single/separate states; '~1I~2' Irix/Solaris mode\n" " f,F Manage Fields: add/remove; change order; select sort field\n" "\n" - " <,> . Move sort field: '~1<~2' next col left; '~1>~2' next col right\n" + " L,&,<,> . Locate: '~1L~2'/'~1&~2' find/again; Move sort column: '~1<~2'/'~1>~2' left/right\n" \ " R,H,V . Toggle: '~1R~2' norm/rev sort; '~1H~2' show threads; '~1V~2' forest view\n" " c,i,S . Toggle: '~1c~2' cmd name/line; '~1i~2' idle tasks; '~1S~2' cumulative time\n" " x~5,~1y~5 . Toggle highlights: '~1x~2' sort field; '~1y~2' running tasks\n" diff --git a/top/top_nls.h b/top/top_nls.h index 6e0b0c2f..3f554e63 100644 --- a/top/top_nls.h +++ b/top/top_nls.h @@ -56,14 +56,15 @@ enum norm_nls { FAIL_alloc_c_txt, FAIL_alloc_r_txt, FAIL_openlib_fmt, FAIL_rc_open_fmt, FAIL_re_nice_fmt, FAIL_sigmask_fmt, FAIL_signals_fmt, FAIL_sigstop_fmt, FAIL_statget_txt, FAIL_statopn_fmt, FAIL_tty_get_txt, FAIL_tty_mod_fmt, - FAIL_tty_raw_fmt, FAIL_widecpu_txt, FAIL_widepid_txt, FOREST_modes_fmt, - FOREST_views_txt, GET_max_task_fmt, GET_nice_num_fmt, GET_pid2kill_txt, - GET_pid2nice_txt, GET_sigs_num_fmt, GET_user_ids_txt, HELP_cmdline_fmt, - HILIGHT_cant_txt, IRIX_curmode_fmt, LIMIT_exceed_fmt, MISSING_args_fmt, - NAME_windows_fmt, NOT_onsecure_txt, NOT_smp_cpus_txt, OFF_one_word_txt, - ON_word_only_txt, RC_bad_entry_fmt, RC_bad_files_fmt, SCROLL_coord_fmt, - SELECT_clash_txt, THREADS_show_fmt, TIME_accumed_fmt, UNKNOWN_cmds_txt, - UNKNOWN_opts_fmt, USAGE_abbrev_txt, WORD_allcpus_txt, WORD_eachcpu_fmt, + FAIL_tty_raw_fmt, FAIL_widecpu_txt, FAIL_widepid_txt, FIND_no_find_fmt, + FIND_no_next_txt, FOREST_modes_fmt, FOREST_views_txt, GET_find_str_txt, + GET_max_task_fmt, GET_nice_num_fmt, GET_pid2kill_txt, GET_pid2nice_txt, + GET_sigs_num_fmt, GET_user_ids_txt, HELP_cmdline_fmt, HILIGHT_cant_txt, + IRIX_curmode_fmt, LIMIT_exceed_fmt, MISSING_args_fmt, NAME_windows_fmt, + NOT_onsecure_txt, NOT_smp_cpus_txt, OFF_one_word_txt, ON_word_only_txt, + RC_bad_entry_fmt, RC_bad_files_fmt, SCROLL_coord_fmt, SELECT_clash_txt, + THREADS_show_fmt, TIME_accumed_fmt, UNKNOWN_cmds_txt, UNKNOWN_opts_fmt, + USAGE_abbrev_txt, WORD_allcpus_txt, WORD_another_txt, WORD_eachcpu_fmt, WORD_process_txt, WORD_threads_txt, WRITE_rcfile_fmt, WRONG_switch_fmt, norm_MAX };