1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

779 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
08efa818aa Merge with http://elinks.cz/elinks.git 2006-01-01 23:55:02 +02:00
Kalle Olavi Niemitalo
dd9b321d15 Moved Perl scripts to a "perl" directory and imported Locale::PO. 2006-01-01 23:32:42 +02:00
Kalle Olavi Niemitalo
21f61c5c06 Specify accelerator contexts for "Form f~ields". 2006-01-01 23:31:41 +02:00
Kalle Olavi Niemitalo
451f23d272 Doh, make the Perl scripts executable. 2006-01-01 19:30:29 +02: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
Laurent MONIN
c3cb0ba44e French translation was updated. 2006-01-01 17:53:34 +01:00
Jonas Fonseca
bb463d17f2 Fix po/Makefile w.r.t. the new value of $(srcdir) when srcdir == buildir 2006-01-01 17:34:12 +01:00
Miciah Dashiel Butler Masters
34588e976d Change the keyboard accelerator for the cookie browser's Clear button
from C to L for great consistency.
2006-01-01 09:16:42 +00:00
Miciah Dashiel Butler Masters
290a03787b Redo a small comment. 2006-01-01 08:07:14 +00: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
ceb9222ee4 Drop a silly 'Setup box_item' comment in add_bookmark. 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
Miciah Dashiel Butler Masters
fca29e75f8 Drop some unneeded comments. 2006-01-01 08:07:13 +00:00
Jonas Fonseca
eee912f2c1 elinks-0.12.GIT 2006-01-01 00:21:28 +01:00
Jonas Fonseca
06ce0f5ee6 elinks-0.11.0 2006-01-01 00:00:05 +01:00
Jonas Fonseca
fbff2505f3 Mention Miciahs spiffy SMJS scripting interface 2005-12-31 23:44:32 +01:00
Jonas Fonseca
6b62e0cb77 Declare struct sgml_parser_state above struct sgml_parser
... and describe the info member.
2005-12-31 20:02:39 +01:00
Jonas Fonseca
f0148c2ecf Keep struct sgml_parsing_state private to the parser 2005-12-31 19:59:11 +01:00
Jonas Fonseca
4a766f350b Just for fun also parse <?xml-stylesheet attributes 2005-12-31 03:13:39 +01:00
Jonas Fonseca
b2295572fe Merge with git+ssh://pasky/srv/git/elinks.git 2005-12-31 02:48:57 +01:00
Jonas Fonseca
a578ed4667 Make the SGML scanner (optionally) keep track of line numbers
A new line is either \n or \f. The main logic for counting lines is in
skip_sgml{,_chars,_space}. For the general case where line numbers are not
wanted the code tries to avoid the extra checks for newlines.

This will be useful for reporting errors when loading the XBEL file.
2005-12-31 02:46:56 +01:00
Russ Rowan
c3066a4076 bugmenot.com changed their format. Back to the old method of handling it. 2005-12-30 20:04:48 -05:00
Jonas Fonseca
b23beed031 Rename skip_comment() and skip_cdata_section() to conform to skip_sgml_*() 2005-12-31 02:00:09 +01:00
Jonas Fonseca
0891cda51e Introduce skip_sgml_space() that wraps scan_sgml(..., SGML_SCAN_WHITESPACE) 2005-12-31 01:57:54 +01:00
Jonas Fonseca
9264221635 Make init_dom_scanner() take the state arg and drop a macro 2005-12-31 01:55:38 +01:00
Jonas Fonseca
7489c134f7 Make non-terminated comments and cdata sections have 'the rest' as content 2005-12-31 01:47:57 +01:00
Jonas Fonseca
8f7f6abc16 Use skip_sgml_chars() in skip_comment() and skip_cdata_section() 2005-12-31 01:40:52 +01:00
Jonas Fonseca
4e10bcf772 Drop useless code for proc. instruction scanning 2005-12-31 01:18:49 +01:00
Jonas Fonseca
e8ff8bd5f0 Fix another off-by-one error similar to the SGML comment parsing 2005-12-31 01:14:52 +01:00
Jonas Fonseca
ab7ba39d42 Introduce skip_sgml_chars() to avoid usage of memchr() 2005-12-31 00:06:12 +01:00
Jonas Fonseca
14a3f9c0fd Disable dom-select building since it requires defining of DOM_STACK_TRACE 2005-12-31 00:05:49 +01:00
Jonas Fonseca
9a0bf83756 Add basic stuff for XBEL parsing/highlighting using the DOM engine 2005-12-30 22:19:32 +01:00
Jonas Fonseca
66248849cd Add an RSS test file 2005-12-30 22:18:22 +01:00
Jonas Fonseca
aa07b3edf4 Fix old (non) problem with using VERSION identifier by #undef'ing it first 2005-12-30 22:13:13 +01:00
Miciah Dashiel Butler Masters
9d713ff41d Write the bookmarks whether or not they are dirty if the backend has
changed since reading.
2005-12-30 21:08:50 +00:00
Jonas Fonseca
c0ece18042 Start showing RSS files in the plain view so it gets highlighted 2005-12-30 21:55:53 +01:00
Jonas Fonseca
65a114f4bc Sort the RSS elements, they are supposed to be binarily searchable 2005-12-30 21:46:44 +01:00
Jonas Fonseca
ad052c3985 Hey, hey Cripple Creek Fai^H^Herry 2005-12-30 21:19:46 +01:00