1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00
Commit Graph

290 Commits

Author SHA1 Message Date
Laurent MONIN
a05b6c0636 hierbox_ev_kbd(): use a switch(). 2006-01-05 11:41:26 +01:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Miciah Dashiel Butler Masters
227150d100 Merge the definition and initialisation of msg in 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
127b27bd49 Use listbox_message. 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
2ee5b85b9e Introduce and use local variable ops, assigned the value of box->ops, 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
985efb99b6 Introduce a macro listbox_message(msg) that tries ops->messages->msg 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
6114066803 Replace unsigned char *delete_messages[2][DELETE_ERRORS] with struct 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
4e83efb6d3 Drop a comment that should have gone with revision 1.129. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
eeed2cd4a8 Use the local variable item instead of context->item, which is assigned 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
247fe95fea In hierbox_ev_kbd, use the local variable selected, which is assigned 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
4eb0cbf271 Introduce and use local variable item, assigned the value of 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
5042a48750 Re-indent recursively_goto_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
6aed6ff96f Factor recursively_goto_listbox out of recursively_goto_each_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
a4209b02fe Rename recursively_goto_listbox to recursively_goto_each_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
963452c65f Rename done_listbox_item parameter box_item to item. 2006-01-01 08:07:13 +00:00
Laurent MONIN
26c9bdf538 Move code from kbd_listbox() to new do_kbd_listbox_action(). 2005-12-26 11:02:39 +01:00
Laurent MONIN
918fed9966 kbd_listbox(): converts if {} stuff to a switch{}. 2005-12-26 10:53:39 +01:00
Laurent MONIN
9683cf429b display_listbox_item(): clarify tests a bit. 2005-12-26 10:39:07 +01:00
Jonas Fonseca
1c3f6a8f3b Place cursor at start of text and only highlight the text in the managers
The old behavior would lead screeanreaders to pronounce items like the
bookmarks as "unknown-unknown-<the link name>". That is the border
chars of the tree view would be renderered as "unknown".

Requested by Klaus Knopper.
2005-12-26 00:26:04 +01:00
Miciah Dashiel Butler Masters
b150fa8c56 #include util/align.h in bfu/msgbox.h. 2005-12-20 10:48:45 +00:00
Miciah Dashiel Butler Masters
d12226d4cb Fix a problem with my rewrite of scroll_menu where selecting an item on
a main menu selects the next item instead.
2005-12-19 03:44:14 +00:00
Miciah Dashiel Butler Masters
82850fab29 Rewrite the better part of scroll_menu so that it is more readable
and wraps properly when the first or last items on a menu are
unselectable. Drop search_selectable, which is now unnecessary.
2005-12-19 01:01:52 +00:00
Miciah Dashiel Butler Masters
fa0ce83f24 Recomment do_tab_compl_unambiguous. 2005-12-17 00:02:15 +00:00
Miciah Dashiel Butler Masters
093800d6fb Only set match the first time since we are only interested in the common
substring at the start, which will be the same for all matches.
2005-12-16 23:59:04 +00:00
Miciah Dashiel Butler Masters
aad46173ae Refactor. 2005-12-16 23:50:17 +00:00
Miciah Dashiel Butler Masters
63a71348f2 Refactor. 2005-12-16 23:48:41 +00:00
Miciah Dashiel Butler Masters
5279ea97da Drop a funny comment. 2005-12-16 23:47:25 +00:00
Miciah Dashiel Butler Masters
20ee738904 Stop using a special value of 0 for longest_common_match to check whether
a match has been found and just check whether match is NULL.
2005-12-16 23:37:52 +00:00
Miciah Dashiel Butler Masters
0f8fe3f919 Define a new routine strcommonlen and use it in do_tab_compl_unambiguous. 2005-12-16 23:35:11 +00:00
Jonas Fonseca
acf2ec806b Remove empty lines in start of header files
A left over from the CVS Id removal. Also, for a few files, normalize the
order in which things are declared in headers.
2005-11-15 11:33:27 +01:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00
Jonas Fonseca
94ed6fa754 Finalize and cleanup the denser Makefile format
Convert remaining conditional file building to use

	OBJS-$(CONFIG_FOO) += foo.o

one problem with reverse meaining (in util/) fixed with local 'hack'.

Cleanup and remove stuff which is now default targets.
2005-09-28 12:38:17 +02:00
Jonas Fonseca
1efab31581 Simplify building of and linking with directories
Ditch the building of an archive (.a) in favour of linking all objects in a
directory into a lib.o file. This makes it easy to link in subdirectories
and more importantly keeps the build logic in the local subdirectories.

Note: after updating you will have to rm **/*.a if you do not make clean
before updating.
2005-09-27 21:38:58 +02:00
Jonas Fonseca
b30064c0d0 Rename targets: *-l -> *-local 2005-09-27 21:11:28 +02:00
Petr Baudis
4e2d48cc93 ELBuildize some more stuff. All for tonight, turn for the Americans. 2005-09-16 05:09:08 +02:00
Jonas Fonseca
7462f22635 Remove now obsolete .cvsignore files. 2005-09-15 18:33:20 +02:00
Petr Baudis
0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00