mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* util.c: Added gettext_ui(), which translates a string and
strips everything before the first '|' character. This function is used to translate special elements of the user interface, like ButtonBar labels. * util.h: Likewise. * view.c: Using the new gettext_ui() function.
This commit is contained in:
parent
48ff22779a
commit
3abff48000
@ -1,3 +1,12 @@
|
||||
2005-07-20 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* util.c: Added gettext_ui(), which translates a string and
|
||||
strips everything before the first '|' character. This function
|
||||
is used to translate special elements of the user interface,
|
||||
like ButtonBar labels.
|
||||
* util.h: Likewise.
|
||||
* view.c: Using the new gettext_ui() function.
|
||||
|
||||
2005-07-17 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* util.c: Added ascii_alpha_to_cntrl(), which converts 'x' to
|
||||
|
10
src/util.c
10
src/util.c
@ -1464,3 +1464,13 @@ ascii_alpha_to_cntrl (int ch)
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
extern const char *
|
||||
gettext_ui (const char *s)
|
||||
{
|
||||
const char *result, *sep;
|
||||
|
||||
result = _(s);
|
||||
sep = strchr(result, '|');
|
||||
return (sep != NULL) ? sep + 1 : result;
|
||||
}
|
||||
|
@ -259,4 +259,8 @@ void save_file_position (const char *filename, long line, long column);
|
||||
* else returns the argument. */
|
||||
extern int ascii_alpha_to_cntrl (int ch);
|
||||
|
||||
/* translates the string and returns the part after the first occurence
|
||||
* of the ``|'' character. */
|
||||
extern const char *gettext_ui (const char *);
|
||||
|
||||
#endif
|
||||
|
60
src/view.c
60
src/view.c
@ -2799,42 +2799,56 @@ view_labels (WView *view)
|
||||
{
|
||||
Dlg_head *h = view->widget.parent;
|
||||
|
||||
buttonbar_set_label (h, 1, _("Help"), view_help_cmd);
|
||||
buttonbar_set_label (h, 1, gettext_ui("ButtonBar|Help"), view_help_cmd);
|
||||
|
||||
my_define (h, 10, _("Quit"), view_quit_cmd, view);
|
||||
my_define (h, 4, view->hex_mode ? _("Ascii") : _("Hex"),
|
||||
toggle_hex_mode, view);
|
||||
my_define (h, 5, view->hex_mode ? _("Goto") : _("Line"),
|
||||
view->hex_mode ? goto_addr : goto_line, view);
|
||||
my_define (h, 6, view->hex_mode ? _("Save") : _("RxSrch"),
|
||||
regexp_search_cmd, view);
|
||||
my_define (h, 10, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
|
||||
my_define (h, 4, view->hex_mode
|
||||
? gettext_ui("ButtonBar|Ascii")
|
||||
: gettext_ui("ButtonBar|Hex"),
|
||||
toggle_hex_mode, view);
|
||||
my_define (h, 5, view->hex_mode
|
||||
? gettext_ui("ButtonBar|Goto")
|
||||
: gettext_ui("ButtonBar|Line"),
|
||||
view->hex_mode ? goto_addr : goto_line, view);
|
||||
my_define (h, 6, view->hex_mode
|
||||
? gettext_ui("ButtonBar|Save")
|
||||
: gettext_ui("ButtonBar|RxSrch"),
|
||||
regexp_search_cmd, view);
|
||||
|
||||
if (view->hex_mode) {
|
||||
if (view->hexedit_mode) {
|
||||
my_define (h, 2, _("View"), toggle_hexedit_mode, view);
|
||||
my_define (h, 2, gettext_ui("ButtonBar|View"),
|
||||
toggle_hexedit_mode, view);
|
||||
} else if (view->datasource == DS_FILE) {
|
||||
my_define (h, 2, _("Edit"), toggle_hexedit_mode, view);
|
||||
my_define (h, 2, gettext_ui("ButtonBar|Edit"),
|
||||
toggle_hexedit_mode, view);
|
||||
} else {
|
||||
my_define (h, 2, "", NULL, view);
|
||||
}
|
||||
} else
|
||||
my_define (h, 2, view->text_wrap_mode ? _("UnWrap") : _("Wrap"),
|
||||
toggle_wrap_mode, view);
|
||||
} else {
|
||||
my_define (h, 2, view->text_wrap_mode
|
||||
? gettext_ui("ButtonBar|UnWrap")
|
||||
: gettext_ui("ButtonBar|Wrap"),
|
||||
toggle_wrap_mode, view);
|
||||
}
|
||||
|
||||
my_define (h, 7, view->hex_mode ? _("HxSrch") : _("Search"),
|
||||
normal_search_cmd, view);
|
||||
|
||||
my_define (h, 8, view->magic_mode ? _("Raw") : _("Parse"),
|
||||
change_viewer, view);
|
||||
my_define (h, 7, view->hex_mode
|
||||
? gettext_ui("ButtonBar|HxSrch")
|
||||
: gettext_ui("ButtonBar|Search"),
|
||||
normal_search_cmd, view);
|
||||
my_define (h, 8, view->magic_mode
|
||||
? gettext_ui("ButtonBar|Raw")
|
||||
: gettext_ui("ButtonBar|Parse"),
|
||||
change_viewer, view);
|
||||
|
||||
/* don't override the key to access the main menu */
|
||||
if (!view_is_in_panel (view)) {
|
||||
my_define (h, 9,
|
||||
view->text_nroff_mode ? _("Unform") : _("Format"),
|
||||
change_nroff, view);
|
||||
my_define (h, 3, _("Quit"), view_quit_cmd, view);
|
||||
my_define (h, 9, view->text_nroff_mode
|
||||
? gettext_ui("ButtonBar|Unform")
|
||||
: gettext_ui("ButtonBar|Format"),
|
||||
change_nroff, view);
|
||||
my_define (h, 3, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
|
||||
}
|
||||
|
||||
buttonbar_redraw (h);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user