* util.c (gettext_ui): Rename to Q_() for glib compatibility,

move ...
* glibcompat.c: ... here.  Adjust all callers.
This commit is contained in:
Pavel Roskin 2005-10-04 15:20:10 +00:00
parent 3baac40355
commit 01f571f1d2
6 changed files with 41 additions and 33 deletions

View File

@ -1,3 +1,9 @@
2005-10-04 Pavel Roskin <proski@gnu.org>
* util.c (gettext_ui): Rename to Q_() for glib compatibility,
move ...
* glibcompat.c: ... here. Adjust all callers.
2005-10-03 Pavel Roskin <proski@gnu.org>
* screen.c (display_mini_info): Use ngettext().

View File

@ -28,6 +28,7 @@
#include <glib.h>
#include "global.h"
#include "glibcompat.h"
#if GLIB_MAJOR_VERSION < 2
@ -110,3 +111,14 @@ g_strlcpy (gchar *dest,
#endif /* GLIB_MAJOR_VERSION < 2 */
#ifndef Q_
const char *
Q_ (const char *s)
{
const char *result, *sep;
result = _(s);
sep = strchr(result, '|');
return (sep != NULL) ? sep + 1 : result;
}
#endif /* ! Q_ */

View File

@ -35,4 +35,8 @@ g_slist_delete_link (GSList *list, GSList *link)
#endif /* GLIB_MAJOR_VERSION < 2 */
#ifndef Q_
const char *Q_ (const char *s);
#endif
#endif

View File

@ -1507,13 +1507,3 @@ 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;
}

View File

@ -261,8 +261,4 @@ 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

View File

@ -2870,55 +2870,55 @@ view_labels (WView *view)
{
Dlg_head *h = view->widget.parent;
buttonbar_set_label (h, 1, gettext_ui("ButtonBar|Help"), view_help_cmd);
buttonbar_set_label (h, 1, Q_("ButtonBar|Help"), view_help_cmd);
my_define (h, 10, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
my_define (h, 10, Q_("ButtonBar|Quit"), view_quit_cmd, view);
my_define (h, 4, view->hex_mode
? gettext_ui("ButtonBar|Ascii")
: gettext_ui("ButtonBar|Hex"),
? Q_("ButtonBar|Ascii")
: Q_("ButtonBar|Hex"),
view_toggle_hex_mode_cmd, view);
my_define (h, 5, view->hex_mode
? gettext_ui("ButtonBar|Goto")
: gettext_ui("ButtonBar|Line"),
? Q_("ButtonBar|Goto")
: Q_("ButtonBar|Line"),
view->hex_mode ? view_moveto_addr_cmd : view_moveto_line_cmd, view);
if (view->hex_mode) {
if (view->hexedit_mode) {
my_define (h, 2, gettext_ui("ButtonBar|View"),
my_define (h, 2, Q_("ButtonBar|View"),
view_toggle_hexedit_mode_cmd, view);
} else if (view->datasource == DS_FILE) {
my_define (h, 2, gettext_ui("ButtonBar|Edit"),
my_define (h, 2, Q_("ButtonBar|Edit"),
view_toggle_hexedit_mode_cmd, view);
} else {
my_define (h, 2, "", NULL, view);
}
my_define (h, 6, gettext_ui("ButtonBar|Save"),
my_define (h, 6, Q_("ButtonBar|Save"),
view_hexedit_save_changes_cmd, view);
} else {
my_define (h, 2, view->text_wrap_mode
? gettext_ui("ButtonBar|UnWrap")
: gettext_ui("ButtonBar|Wrap"),
? Q_("ButtonBar|UnWrap")
: Q_("ButtonBar|Wrap"),
view_toggle_wrap_mode_cmd, view);
my_define (h, 6, gettext_ui("ButtonBar|RxSrch"),
my_define (h, 6, Q_("ButtonBar|RxSrch"),
view_regexp_search_cmd, view);
}
my_define (h, 7, view->hex_mode
? gettext_ui("ButtonBar|HxSrch")
: gettext_ui("ButtonBar|Search"),
? Q_("ButtonBar|HxSrch")
: Q_("ButtonBar|Search"),
view_normal_search_cmd, view);
my_define (h, 8, view->magic_mode
? gettext_ui("ButtonBar|Raw")
: gettext_ui("ButtonBar|Parse"),
? Q_("ButtonBar|Raw")
: Q_("ButtonBar|Parse"),
view_toggle_magic_mode_cmd, 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
? gettext_ui("ButtonBar|Unform")
: gettext_ui("ButtonBar|Format"),
? Q_("ButtonBar|Unform")
: Q_("ButtonBar|Format"),
view_toggle_nroff_mode_cmd, view);
my_define (h, 3, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
my_define (h, 3, Q_("ButtonBar|Quit"), view_quit_cmd, view);
}
}