diff --git a/po/Makefile b/po/Makefile index 57b2bdd45..13c453689 100644 --- a/po/Makefile +++ b/po/Makefile @@ -49,13 +49,14 @@ $(srcdir)/$(POTFILES_ABS_LIST): find src/ -type f -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort ) \ > $(srcdir)/$(POTFILES_ABS_LIST) -$(srcdir)/$(PACKAGE).pot: $(srcdir)/$(POTFILES_ABS_LIST) +$(srcdir)/$(PACKAGE).pot: $(srcdir)/$(POTFILES_ABS_LIST) $(srcdir)/gather-accelerator-contexts.pl $(XGETTEXT) --default-domain=$(PACKAGE) \ --directory=$(top_srcdir) \ --add-comments --language=C \ --keyword=_ --keyword=N_ --keyword=n_:1,2 --keyword=N__ -f $(srcdir)/$(POTFILES_ABS_LIST) \ && test -f $(PACKAGE).po \ - && mv -f $(PACKAGE).po $(srcdir)/$(PACKAGE).pot + && $(srcdir)/gather-accelerator-contexts.pl $(top_srcdir) $(PACKAGE).po \ + && mv -f $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ### Updating po and gmo files @@ -89,6 +90,7 @@ check-po: @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \ echo -n "$(lang): "; \ $(GMSGFMT) --check --check-accelerators=~ --verbose --statistics -o /dev/null $(srcdir)/$(lang).po; \ + $(srcdir)/check-accelerator-contexts.pl $(srcdir)/$(lang).po \ ) ### Installation and distribution diff --git a/po/check-accelerator-contexts.pl b/po/check-accelerator-contexts.pl new file mode 100644 index 000000000..7cb4b6661 --- /dev/null +++ b/po/check-accelerator-contexts.pl @@ -0,0 +1,36 @@ +#! /usr/bin/perl +use strict; +use warnings; +use Locale::PO qw(); + +my %contexts; +my($pofile) = @ARGV; +my $pos = do { + # Locale::PO 0.16 doesn't understand "#~" obsolete lines and spews warnings. + local $SIG{__WARN__} = sub {}; + Locale::PO->load_file_asarray($pofile) or die "$pofile: $!"; +}; +foreach my $po (@$pos) { + next if $po->fuzzy(); + my $msgstr = $po->msgstr() + or next; + my($accelerator) = ($msgstr =~ /~(.)/) + or next; + $accelerator = uc($accelerator); + my $automatic = $po->automatic() + or next; + my($contexts) = ($automatic =~ /^accelerator_context\(([^\)]*)\)/) + or next; + foreach my $context (split(/\s*,\s*/, $contexts)) { + my $prev = $contexts{$context}{$accelerator}; + if (defined($prev)) { + warn "$pofile: Accelerator conflict for \"$accelerator\" in \"$context\":\n"; + warn "$pofile: 1st msgid " . $prev->msgid() . "\n"; + warn "$pofile: 1st msgstr " . $prev->msgstr() . "\n"; + warn "$pofile: 2nd msgid " . $po->msgid() . "\n"; + warn "$pofile: 2nd msgstr " . $po->msgstr() . "\n"; + } else { + $contexts{$context}{$accelerator} = $po; + } + } +} diff --git a/po/gather-accelerator-contexts.pl b/po/gather-accelerator-contexts.pl new file mode 100644 index 000000000..85b441dd8 --- /dev/null +++ b/po/gather-accelerator-contexts.pl @@ -0,0 +1,106 @@ +#! /usr/bin/perl +use strict; +use warnings; +use Locale::PO qw(); + +{ + package Contextline; + use fields qw(lineno contexts); + sub new { + my($self, $lineno, $contexts) = @_; + $self = fields::new($self) unless ref $self; + $self->{lineno} = $lineno; + $self->{contexts} = $contexts; + return $self; + } +} + +# Each key is a file name. +# Each value is a reference to an array of references to Contextline +# pseudo-hashes. The array is in ascending order by {lineno}. +my %Srcfiles; + +# Scan the $srcfile for gettext_accelerator_context directives, +# cache the result in %Srcfiles, and return it in that format. +sub contextlines ($$) +{ + my($top_srcdir, $srcfile) = @_; + return $Srcfiles{$srcfile} if exists($Srcfiles{$srcfile}); + + local $_; + my @contextlines = (); + my @prevctxs; + open my $srcfd, "<", "$top_srcdir/$srcfile" or die "$top_srcdir/$srcfile: $!"; + while (<$srcfd>) { + chomp; + if (/^\}/ && @prevctxs) { + push @contextlines, Contextline->new($., [@prevctxs = ()]); + } + if (my($contexts) = /\[gettext_accelerator_context\(([^()]*)\)\]/) { + my @contexts = grep { $_ ne "" } split(/\s*,\s*/, $contexts); + foreach (@contexts) { s/^\./${srcfile}:/ } + warn "$srcfile:$.: Previous context not closed\n" + if @prevctxs && @contexts; + warn "$srcfile:$.: Context already closed\n" + if !@prevctxs && !@contexts; + push @contextlines, Contextline->new($., [@prevctxs = @contexts]); + } elsif (/gettext_accelerator_context/) { + warn "$srcfile:$.: Suspicious non-directive: $_\n"; + } + } + warn "$srcfile:$.: Last context not closed\n" if @prevctxs; + + return $Srcfiles{$srcfile} = \@contextlines; +} + +sub contexts ($$$) +{ + my($top_srcdir, $srcfile, $lineno) = @_; + # Could use a binary search here. + my $contextlines = contextlines($top_srcdir, $srcfile); + my @contexts = (); + foreach my Contextline $contextline (@{$contextlines}) { + return @contexts if $contextline->{lineno} > $lineno; + @contexts = @{$contextline->{contexts}}; + } + return (); +} + +sub format_contexts (@) +{ + if (@_) { + return "#. accelerator_context(" . join(", ", @_) . ")\n"; + } else { + return ""; + } +} + +my($top_srcdir, $pofile) = @ARGV; +my $pos = Locale::PO->load_file_asarray($pofile) or die "$pofile: $!"; +foreach my $po (@$pos) { + my $automatic = $po->automatic(); + $automatic =~ s/^\[gettext_accelerator_context\(.*(?:\n|\z)//mg + if defined($automatic); + + if ($po->msgid() =~ /\~/) { + my @po_contexts = (); + foreach my $ref (split(' ', $po->reference())) { + my @parts = split(/\:/, $ref); + warn "weird reference: $ref\n", next unless @parts == 2; + my @ref_contexts = contexts($top_srcdir, $parts[0], $parts[1]); + if (@ref_contexts) { + push @po_contexts, grep { $_ ne "IGNORE" } @ref_contexts; + } else { + warn "$ref: No accelerator context for msgid " . $po->msgid() . "\n"; + } + } + if (@po_contexts) { + # sort and uniquify + @po_contexts = sort keys %{{map { $_ => 1 } @po_contexts}}; + $automatic .= "\n" if defined($automatic) and $automatic ne ""; + $automatic .= "accelerator_context(" . join(", ", @po_contexts) . ")"; + } + } + $po->automatic($automatic); +} +Locale::PO->save_file_fromarray($pofile, $pos) or die "$pofile: $!"; diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index c30d0747f..cd733abea 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -405,6 +405,7 @@ done_listbox_context(void *context_) widget_handler_status_T push_hierbox_info_button(struct dialog_data *dlg_data, struct widget_data *button) { + /* [gettext_accelerator_context(push_hierbox_info_button)] */ struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct terminal *term = dlg_data->win->term; struct listbox_context *context; @@ -692,6 +693,7 @@ widget_handler_status_T push_hierbox_delete_button(struct dialog_data *dlg_data, struct widget_data *button) { + /* [gettext_accelerator_context(push_hierbox_delete_button)] */ struct terminal *term = dlg_data->win->term; struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_context *context; @@ -816,6 +818,7 @@ widget_handler_status_T push_hierbox_clear_button(struct dialog_data *dlg_data, struct widget_data *button) { + /* [gettext_accelerator_context(push_hierbox_clear_button)] */ struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct terminal *term = dlg_data->win->term; struct listbox_context *context; diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c index fd14f0029..5c4359de4 100644 --- a/src/bfu/inpfield.c +++ b/src/bfu/inpfield.c @@ -250,7 +250,8 @@ input_dialog(struct terminal *term, struct memory_list *ml, widget_handler_T *check, void (*fn)(void *, unsigned char *), void (*cancelfn)(void *)) -{ +{ + /* [gettext_accelerator_context(input_dialog)] */ input_field(term, ml, 1, title, text, N_("~OK"), N_("~Cancel"), data, history, l, def, min, max, diff --git a/src/bfu/msgbox.c b/src/bfu/msgbox.c index 9494bbfab..00924cbd0 100644 --- a/src/bfu/msgbox.c +++ b/src/bfu/msgbox.c @@ -160,6 +160,7 @@ refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, unsigned char *(get_info)(struct terminal *, void *), void *data) { + /* [gettext_accelerator_context(refreshed_msg_box)] */ struct dialog_data *dlg_data; unsigned char *info = get_info(term, data); @@ -185,6 +186,7 @@ info_box(struct terminal *term, enum msgbox_flags flags, unsigned char *title, enum format_align align, unsigned char *text) { + /* [gettext_accelerator_context(info_box)] */ return msg_box(term, NULL, flags, title, align, text, NULL, 1, N_("~OK"), NULL, B_ENTER | B_ESC); } diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index 1d9df2af6..cf39660fe 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -459,6 +459,7 @@ push_move_button(struct dialog_data *dlg_data, /**** MANAGEMENT *****************************************************/ static struct hierbox_browser_button bookmark_buttons[] = { + /* [gettext_accelerator_context(.bookmark_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Edit"), push_edit_button, 0 }, { N_("~Delete"), push_hierbox_delete_button, 0 }, diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 7839eb349..0abb13d33 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -225,6 +225,7 @@ static struct listbox_ops cache_entry_listbox_ops = { }; static struct hierbox_browser_button cache_buttons[] = { + /* [gettext_accelerator_context(.cache_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Delete"), push_hierbox_delete_button, 1 }, diff --git a/src/config/cmdline.c b/src/config/cmdline.c index 98b561afd..fcabd0643 100644 --- a/src/config/cmdline.c +++ b/src/config/cmdline.c @@ -643,6 +643,7 @@ printconfigdump_cmd(struct option *option, unsigned char ***argv, int *argc) /* Keep options in alphabetical order. */ struct option_info cmdline_options_info[] = { + /* [gettext_accelerator_context(IGNORE)] */ INIT_OPT_BOOL("", N_("Restrict to anonymous mode"), "anonymous", 0, 0, N_("Restricts ELinks so it can run on an anonymous account.\n" diff --git a/src/config/dialogs.c b/src/config/dialogs.c index d649d249a..694940986 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -43,6 +43,7 @@ void write_config_dialog(struct terminal *term, unsigned char *config_file, int secsave_error, int stdio_error) { + /* [gettext_accelerator_context(write_config_dialog)] */ unsigned char *errmsg = NULL; unsigned char *strerr; @@ -327,6 +328,7 @@ static void build_edit_dialog(struct terminal *term, struct session *ses, struct option *option) { + /* [gettext_accelerator_context(.build_edit_dialog)] */ #define EDIT_WIDGETS_COUNT 5 struct dialog *dlg; unsigned char *value, *name, *desc, *range; @@ -523,6 +525,7 @@ push_save_button(struct dialog_data *dlg_data, static struct hierbox_browser_button option_buttons[] = { + /* [gettext_accelerator_context(.option_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Edit"), push_edit_button, 0 }, { N_("~Add"), push_add_button, 0 }, @@ -809,6 +812,7 @@ really_really_add_keybinding(void *data) static void really_add_keybinding(void *data, unsigned char *keystroke) { + /* [gettext_accelerator_context(.really_add_keybinding.yn)] */ struct kbdbind_add_hop *hop = data; action_id_T action_id; @@ -936,6 +940,7 @@ push_kbdbind_save_button(struct dialog_data *dlg_data, static INIT_LIST_HEAD(keybinding_dialog_list); static struct hierbox_browser_button keybinding_buttons[] = { + /* [gettext_accelerator_context(.keybinding_buttons)] */ { N_("~Add"), push_kbdbind_add_button, 0 }, { N_("~Delete"), push_hierbox_delete_button, 0 }, { N_("~Toggle display"), push_kbdbind_toggle_display_button, 1 }, diff --git a/src/config/options.inc b/src/config/options.inc index 7e69d12a1..f48197ae3 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -15,6 +15,7 @@ * 5. Love thy option system! :) */ static struct option_info config_options_info[] = { + /* [gettext_accelerator_context(IGNORE)] */ INIT_OPT_TREE("", N_("Configuration system"), "config", 0, N_("Configuration handling options.")), diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index 2623576de..9b602f23c 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -54,6 +54,7 @@ add_cookie_info_to_string(struct string *string, struct cookie *cookie, void accept_cookie_dialog(struct session *ses, void *data) { + /* [gettext_accelerator_context(accept_cookie_dialog)] */ struct cookie *cookie = cookie_queries.next; struct string string; @@ -310,6 +311,7 @@ static void build_edit_dialog(struct terminal *term, struct cookie *cookie) { #define EDIT_WIDGETS_COUNT 8 + /* [gettext_accelerator_context(.build_edit_dialog)] */ struct dialog *dlg; unsigned char *name, *value, *domain, *expires, *secure; unsigned char *dlg_server; @@ -416,6 +418,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button) } static struct hierbox_browser_button cookie_buttons[] = { + /* [gettext_accelerator_context(.cookie_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Add"), push_add_button, 1 }, { N_("~Edit"), push_edit_button, 1 }, diff --git a/src/dialogs/download.c b/src/dialogs/download.c index 496133ede..8a0d1ffdc 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -218,6 +218,7 @@ void display_download(struct terminal *term, struct file_download *file_download, struct session *ses) { + /* [gettext_accelerator_context(display_download)] */ struct dialog *dlg; if (!is_in_downloads_list(file_download)) @@ -475,6 +476,7 @@ push_info_button(struct dialog_data *dlg_data, struct widget_data *button) * - Toggle notify button */ static struct hierbox_browser_button download_buttons[] = { + /* [gettext_accelerator_context(.download_buttons)] */ { N_("~Info"), push_info_button }, { N_("~Abort"), push_hierbox_delete_button }, #if 0 diff --git a/src/dialogs/edit.c b/src/dialogs/edit.c index 9805443c9..b920760f4 100644 --- a/src/dialogs/edit.c +++ b/src/dialogs/edit.c @@ -48,6 +48,7 @@ do_edit_dialog(struct terminal *term, int intl, unsigned char *title, void *done_data, enum edit_dialog_type dialog_type) { + /* [gettext_accelerator_context(do_edit_dialog)] */ unsigned char *name, *url; struct dialog *dlg; diff --git a/src/dialogs/info.c b/src/dialogs/info.c index c70511ff2..5263f65c2 100644 --- a/src/dialogs/info.c +++ b/src/dialogs/info.c @@ -58,6 +58,7 @@ push_toggle_keys_display_button(void *data) void menu_keys(struct terminal *term, void *d_, void *xxx) { + /* [gettext_accelerator_context(menu_keys)] */ int d = (long) d_; /* We scale by main mapping because it has the most actions */ diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 392869df6..5eff89c35 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -115,6 +115,7 @@ dont_exit_prog(struct session *ses) void query_exit(struct session *ses) { + /* [gettext_accelerator_context(query_exit)] */ ses->exit_query = 1; msg_box(ses->tab->term, NULL, 0, N_("Exit ELinks"), ALIGN_CENTER, @@ -215,6 +216,7 @@ unhistory_menu(struct terminal *term, void *xxx, void *ses_) void tab_menu(struct session *ses, int x, int y, int place_above_cursor) { + /* [gettext_accelerator_context(tab_menu.uri_frame, tab_menu.uri_link, tab_menu.uri_tab)] */ struct menu_item *menu; int tabs; #ifdef CONFIG_BOOKMARKS @@ -297,6 +299,7 @@ do_submenu(struct terminal *term, void *menu_, void *ses_) static struct menu_item file_menu11[] = { + /* [gettext_accelerator_context(.file_menu)] */ INIT_MENU_ACTION(N_("Open new ~tab"), ACT_MAIN_OPEN_NEW_TAB), INIT_MENU_ACTION(N_("Open new tab in backgroun~d"), ACT_MAIN_OPEN_NEW_TAB_IN_BACKGROUND), INIT_MENU_ACTION(N_("~Go to URL"), ACT_MAIN_GOTO_URL), @@ -307,6 +310,7 @@ static struct menu_item file_menu11[] = { }; static struct menu_item file_menu21[] = { + /* [gettext_accelerator_context(.file_menu)] */ BAR_MENU_ITEM, INIT_MENU_ACTION(N_("~Save as"), ACT_MAIN_SAVE_AS), INIT_MENU_ACTION(N_("Save UR~L as"), ACT_MAIN_SAVE_URL_AS), @@ -317,6 +321,7 @@ static struct menu_item file_menu21[] = { }; static struct menu_item file_menu22[] = { + /* [gettext_accelerator_context(.file_menu)] */ BAR_MENU_ITEM, INIT_MENU_ACTION(N_("~Kill background connections"), ACT_MAIN_KILL_BACKGROUNDED_CONNECTIONS), INIT_MENU_ACTION(N_("Flush all ~caches"), ACT_MAIN_CACHE_MINIMIZE), @@ -325,6 +330,7 @@ static struct menu_item file_menu22[] = { }; static struct menu_item file_menu3[] = { + /* [gettext_accelerator_context(.file_menu)] */ BAR_MENU_ITEM, INIT_MENU_ACTION(N_("E~xit"), ACT_MAIN_QUIT), NULL_MENU_ITEM, @@ -333,6 +339,7 @@ static struct menu_item file_menu3[] = { static void do_file_menu(struct terminal *term, void *xxx, void *ses_) { + /* [gettext_accelerator_context(.file_menu)] */ struct menu_item *file_menu, *e, *f; int anonymous = get_cmd_opt_bool("anonymous"); int x, o; @@ -394,6 +401,7 @@ do_file_menu(struct terminal *term, void *xxx, void *ses_) } static struct menu_item view_menu[] = { + /* [gettext_accelerator_context(.view_menu)] */ INIT_MENU_ACTION(N_("~Search"), ACT_MAIN_SEARCH), INIT_MENU_ACTION(N_("Search ~backward"), ACT_MAIN_SEARCH_BACK), INIT_MENU_ACTION(N_("Find ~next"), ACT_MAIN_FIND_NEXT), @@ -420,6 +428,7 @@ static struct menu_item view_menu[] = { static struct menu_item help_menu[] = { + /* [gettext_accelerator_context(.help_menu)] */ INIT_MENU_ITEM(N_("~ELinks homepage"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_HOMEPAGE, 0), INIT_MENU_ITEM(N_("~Documentation"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_DOC_URL, 0), INIT_MENU_ITEM(N_("~Keys"), NULL, ACT_MAIN_NONE, menu_keys, NULL, 0), @@ -439,6 +448,7 @@ static struct menu_item help_menu[] = { static struct menu_item ext_menu[] = { + /* [gettext_accelerator_context(.ext_menu)] */ INIT_MENU_ITEM(N_("~Add"), NULL, ACT_MAIN_NONE, menu_add_ext, NULL, 0), INIT_MENU_ITEM(N_("~Modify"), NULL, ACT_MAIN_NONE, menu_list_ext, menu_add_ext, SUBMENU), INIT_MENU_ITEM(N_("~Delete"), NULL, ACT_MAIN_NONE, menu_list_ext, menu_del_ext, SUBMENU), @@ -446,6 +456,7 @@ static struct menu_item ext_menu[] = { }; static struct menu_item setup_menu[] = { + /* [gettext_accelerator_context(.setup_menu)] */ #ifdef CONFIG_NLS INIT_MENU_ITEM(N_("~Language"), NULL, ACT_MAIN_NONE, menu_language_list, NULL, SUBMENU), #endif @@ -460,6 +471,7 @@ static struct menu_item setup_menu[] = { }; static struct menu_item setup_menu_anon[] = { + /* [gettext_accelerator_context(.setup_menu)] */ INIT_MENU_ITEM(N_("~Language"), NULL, ACT_MAIN_NONE, menu_language_list, NULL, SUBMENU), INIT_MENU_ITEM(N_("C~haracter set"), NULL, ACT_MAIN_NONE, charset_list, NULL, SUBMENU), INIT_MENU_ACTION(N_("~Terminal options"), ACT_MAIN_SHOW_TERM_OPTIONS), @@ -467,6 +479,7 @@ static struct menu_item setup_menu_anon[] = { }; static struct menu_item tools_menu[] = { + /* [gettext_accelerator_context(.tools_menu)] */ #ifdef CONFIG_GLOBHIST INIT_MENU_ACTION(N_("Global ~history"), ACT_MAIN_HISTORY_MANAGER), #endif @@ -497,6 +510,7 @@ do_setup_menu(struct terminal *term, void *xxx, void *ses_) } static struct menu_item main_menu[] = { + /* [gettext_accelerator_context(.main_menu)] */ INIT_MENU_ITEM(N_("~File"), NULL, ACT_MAIN_NONE, do_file_menu, NULL, FREE_LIST | SUBMENU), INIT_MENU_ITEM(N_("~View"), NULL, ACT_MAIN_NONE, do_submenu, view_menu, FREE_LIST | SUBMENU), INIT_MENU_ITEM(N_("~Link"), NULL, ACT_MAIN_NONE, link_menu, NULL, FREE_LIST | SUBMENU), @@ -867,19 +881,25 @@ add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type) switch (type) { case PASS_URI_FRAME: + /* [gettext_accelerator_context(tab_menu.uri_frame)] */ action_id = ACT_MAIN_FRAME_EXTERNAL_COMMAND; text = N_("~Pass frame URI to external command"); + /* [gettext_accelerator_context()] */ break; case PASS_URI_LINK: + /* [gettext_accelerator_context(tab_menu.uri_link)] */ action_id = ACT_MAIN_LINK_EXTERNAL_COMMAND; text = N_("Pass link URI to e~xternal command"); + /* [gettext_accelerator_context()] */ break; default: case PASS_URI_TAB: + /* [gettext_accelerator_context(tab_menu.uri_tab)] */ action_id = ACT_MAIN_TAB_EXTERNAL_COMMAND; text = N_("Pass tab URI to e~xternal command"); + /* [gettext_accelerator_context()] */ }; foreach (option, *tree) { diff --git a/src/dialogs/options.c b/src/dialogs/options.c index 9e923632a..70836da34 100644 --- a/src/dialogs/options.c +++ b/src/dialogs/options.c @@ -135,6 +135,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button) void terminal_options(struct terminal *term, void *xxx, struct session *ses) { + /* [gettext_accelerator_context(terminal_options)] */ struct dialog *dlg; union option_value *values; int anonymous = get_cmd_opt_bool("anonymous"); @@ -267,6 +268,7 @@ push_resize_button(void *data) void resize_terminal_dialog(struct terminal *term) { + /* [gettext_accelerator_context(resize_terminal_dialog)] */ struct dialog *dlg; int width = int_min(term->width, 999); int height = int_min(term->height, 999); diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index aff6c2db5..c9d9beb38 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -205,6 +205,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button) } static struct hierbox_browser_button formhist_buttons[] = { + /* [gettext_accelerator_context(.formhist_buttons)] */ { N_("~Login"), push_login_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Delete"), push_hierbox_delete_button, 1 }, diff --git a/src/formhist/formhist.c b/src/formhist/formhist.c index 4213183d2..5ef154298 100644 --- a/src/formhist/formhist.c +++ b/src/formhist/formhist.c @@ -376,6 +376,7 @@ void memorize_form(struct session *ses, struct list_head *submit, struct form *forminfo) { + /* [gettext_accelerator_context(memorize_form)] */ struct formhist_data *form; struct submitted_value *sv; int save = 0; diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 328e76f66..f52af9322 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -220,6 +220,7 @@ push_bookmark_button(struct dialog_data *dlg_data, /* The global history manager: */ static struct hierbox_browser_button globhist_buttons[] = { + /* [gettext_accelerator_context(.globhist_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, #ifdef CONFIG_BOOKMARKS diff --git a/src/mime/dialogs.c b/src/mime/dialogs.c index e3199c46f..efbb93dd9 100644 --- a/src/mime/dialogs.c +++ b/src/mime/dialogs.c @@ -50,6 +50,7 @@ really_del_ext(void *fcp) void menu_del_ext(struct terminal *term, void *fcp, void *xxx2) { + /* [gettext_accelerator_context(menu_del_ext)] */ struct option *opt = NULL; unsigned char *extension = fcp; @@ -96,6 +97,7 @@ add_mime_extension(void *data) void menu_add_ext(struct terminal *term, void *fcp, void *xxx2) { + /* [gettext_accelerator_context(menu_add_ext)] */ struct extension *new; struct dialog *dlg; diff --git a/src/osdep/newwin.c b/src/osdep/newwin.c index 8d82e6ffe..ef55f42c6 100644 --- a/src/osdep/newwin.c +++ b/src/osdep/newwin.c @@ -23,18 +23,26 @@ #endif const struct open_in_new open_in_new[] = { + /* [gettext_accelerator_context(open_in_new.os2, open_in_new.win32, open_in_new.beos)] */ { ENV_XWIN, XTERM_CMD, N_("~Xterm") }, { ENV_TWIN, DEFAULT_TWTERM_CMD, N_("T~wterm") }, { ENV_SCREEN, DEFAULT_SCREEN_CMD, N_("~Screen") }, + /* [gettext_accelerator_context()] */ #ifdef CONFIG_OS2 + /* [gettext_accelerator_context(open_in_new.os2)] */ { ENV_OS2VIO, DEFAULT_OS2_WINDOW_CMD, N_("~Window") }, { ENV_OS2VIO, DEFAULT_OS2_FULLSCREEN_CMD, N_("~Full screen") }, + /* [gettext_accelerator_context()] */ #endif #ifdef CONFIG_WIN32 + /* [gettext_accelerator_context(open_in_new.win32)] */ { ENV_WIN32, "", N_("~Window") }, + /* [gettext_accelerator_context()] */ #endif #ifdef CONFIG_BEOS + /* [gettext_accelerator_context(open_in_new.beos)] */ { ENV_BE, DEFAULT_BEOS_TERM_CMD, N_("~BeOS terminal") }, + /* [gettext_accelerator_context()] */ #endif { 0, NULL, NULL } }; diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index d2f53bb66..6d6f6e036 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -70,6 +70,7 @@ auth_cancel(void *data) void do_auth_dialog(struct session *ses, void *data) { + /* [gettext_accelerator_context(do_auth_dialog)] */ struct dialog *dlg; struct dialog_data *dlg_data; struct terminal *term = ses->tab->term; @@ -252,6 +253,7 @@ static struct listbox_ops auth_listbox_ops = { }; static struct hierbox_browser_button auth_buttons[] = { + /* [gettext_accelerator_context(.auth_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Delete"), push_hierbox_delete_button, 1 }, diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index 60fb93a60..688a4727e 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -684,6 +684,7 @@ static void bittorrent_query_callback(void *data, enum connection_state state, struct string *response) { + /* [gettext_accelerator_context(.bittorrent_query_callback)] */ struct type_query *type_query = data; struct string filename; unsigned char *text; diff --git a/src/protocol/protocol.c b/src/protocol/protocol.c index 388b5b674..9cafc0005 100644 --- a/src/protocol/protocol.c +++ b/src/protocol/protocol.c @@ -198,6 +198,7 @@ get_protocol_handler(enum protocol protocol) static void generic_external_protocol_handler(struct session *ses, struct uri *uri) { + /* [gettext_accelerator_context(generic_external_protocol_handler)] */ enum connection_state state; switch (uri->protocol) { diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 605f75ca0..3af4c3479 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -341,6 +341,7 @@ dialog_run_lua(void *data_) static int l_edit_bookmark_dialog(LS) { + /* [gettext_accelerator_context(.l_edit_bookmark_dialog)] */ struct terminal *term = lua_ses->tab->term; struct dialog *dlg; struct lua_dlg_data *data; @@ -415,6 +416,7 @@ xdialog_run_lua(void *data_) static int l_xdialog(LS) { + /* [gettext_accelerator_context(.l_xdialog)] */ struct terminal *term; struct dialog *dlg; struct lua_xdialog_data *data; diff --git a/src/session/download.c b/src/session/download.c index a0a075a95..d77e6c0ce 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -469,6 +469,7 @@ lookup_unique_name(struct terminal *term, unsigned char *ofile, int resume, void (*callback)(struct terminal *, unsigned char *, void *, int), void *data) { + /* [gettext_accelerator_context(.lookup_unique_name)] */ struct lun_hop *lun_hop; unsigned char *file; int overwrite; @@ -989,6 +990,7 @@ tp_open(struct type_query *type_query) static void do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_handler *handler) { + /* [gettext_accelerator_context(.do_type_query)] */ struct string filename; unsigned char *description; unsigned char *desc_sep; diff --git a/src/session/session.c b/src/session/session.c index e7664c20e..097c57039 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -742,6 +742,7 @@ dialog_goto_url_open(void *data) static int setup_first_session(struct session *ses, struct uri *uri) { + /* [gettext_accelerator_context(setup_first_session)] */ struct terminal *term = ses->tab->term; if (!*get_opt_str("protocol.http.user_agent")) { diff --git a/src/session/task.c b/src/session/task.c index 1e4b849fa..ee827ceff 100644 --- a/src/session/task.c +++ b/src/session/task.c @@ -160,6 +160,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, struct location *target_location, enum cache_mode cache_mode, enum task_type task_type, int redir) { + /* [gettext_accelerator_context(ses_goto)] */ struct task *task; int referrer_incomplete = 0; int malicious_uri = 0; diff --git a/src/terminal/tab.c b/src/terminal/tab.c index 02b8409f5..9bb7a6b1e 100644 --- a/src/terminal/tab.c +++ b/src/terminal/tab.c @@ -172,6 +172,7 @@ really_close_tab(struct session *ses) void close_tab(struct terminal *term, struct session *ses) { + /* [gettext_accelerator_context(close_tab)] */ int num_tabs = number_of_tabs(term); if (num_tabs < 2) { @@ -212,6 +213,7 @@ really_close_tabs(struct session *ses) void close_all_tabs_but_current(struct session *ses) { + /* [gettext_accelerator_context(close_all_tabs_but_current)] */ assert(ses); if_assert_failed return; diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index 2321b49a4..4128d2cd3 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -1145,9 +1145,12 @@ link_menu(struct terminal *term, void *xxx, void *ses_) if (link->where && !link_is_form(link)) { if (link->type == LINK_MAP) { + /* [gettext_accelerator_context(link_menu.map)] */ add_to_menu(&mi, N_("Display ~usemap"), NULL, ACT_MAIN_LINK_FOLLOW, NULL, NULL, SUBMENU); + /* [gettext_accelerator_context()] */ } else { + /* [gettext_accelerator_context(link_menu.std)] */ add_menu_action(&mi, N_("~Follow link"), ACT_MAIN_LINK_FOLLOW); add_menu_action(&mi, N_("Follow link and r~eload"), ACT_MAIN_LINK_FOLLOW_RELOAD); @@ -1171,6 +1174,7 @@ link_menu(struct terminal *term, void *xxx, void *ses_) #endif add_uri_command_to_menu(&mi, PASS_URI_LINK); } + /* [gettext_accelerator_context()] */ } } @@ -1178,10 +1182,13 @@ link_menu(struct terminal *term, void *xxx, void *ses_) if (fc) { switch (fc->type) { case FC_RESET: + /* [gettext_accelerator_context(link_menu.reset)] */ add_menu_action(&mi, N_("~Reset form"), ACT_MAIN_RESET_FORM); + /* [gettext_accelerator_context()] */ break; case FC_TEXTAREA: + /* [gettext_accelerator_context(link_menu.textarea)] */ if (!form_field_is_readonly(fc)) { struct string keystroke; @@ -1195,8 +1202,10 @@ link_menu(struct terminal *term, void *xxx, void *ses_) keystroke.source, ACT_MAIN_NONE, menu_textarea_edit, NULL, FREE_RTEXT); } + /* [gettext_accelerator_context()] */ /* Fall through */ default: + /* [gettext_accelerator_context(link_menu.textarea, link_menu.form)] */ add_menu_action(&mi, N_("~Submit form"), ACT_MAIN_SUBMIT_FORM); add_menu_action(&mi, N_("Submit form and rel~oad"), ACT_MAIN_SUBMIT_FORM_RELOAD); @@ -1215,13 +1224,16 @@ link_menu(struct terminal *term, void *xxx, void *ses_) add_menu_action(&mi, N_("Submit form and ~download"), ACT_MAIN_LINK_DOWNLOAD); add_menu_action(&mi, N_("~Reset form"), ACT_MAIN_RESET_FORM); + /* [gettext_accelerator_context()] */ } } if (link->where_img) { + /* [gettext_accelerator_context(link_menu.map, link_menu.std, link_menu.form)] */ add_menu_action(&mi, N_("V~iew image"), ACT_MAIN_VIEW_IMAGE); if (!get_cmd_opt_bool("anonymous")) add_menu_action(&mi, N_("Download ima~ge"), ACT_MAIN_LINK_DOWNLOAD_IMAGE); + /* [gettext_accelerator_context()] */ } /* TODO: Make it possible to trigger any script event hooks associated diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 537168820..259de2570 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1551,6 +1551,7 @@ search_dlg_do(struct terminal *term, struct memory_list *ml, struct input_history *history, void (*fn)(void *, unsigned char *)) { + /* [gettext_accelerator_context(.search_dlg_do)] */ struct dialog *dlg; unsigned char *field; struct search_dlg_hop *hop;