1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00
Go to file
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
config Update config.sub to version in GNU config CVS 2005-11-30 01:27:24 +01:00
contrib Oops, add missing description of preformat hook return value 2005-11-26 01:22:14 +01:00
debian Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
doc Fix elinks.1 rebuilding by changing top_srcdir with top_builddir 2005-12-06 12:21:50 +01:00
po Here is a framework that detects cases where a PO file assigns 2006-01-01 18:55:18 +02:00
src Here is a framework that detects cases where a PO file assigns 2006-01-01 18:55:18 +02:00
test Add a file for script types testing. 2005-11-02 16:55:15 +01:00
Unicode Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
.gitignore Remove traces of nuts and automake. 2005-09-16 13:44:33 +02:00
.vimrc Add root .vimrc which didn't make it in the CVS->GIT convertion. 2005-09-15 17:38:20 +02:00
ABOUT-NLS Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
AUTHORS Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2005-10-24 00:32:42 +00:00
autogen.sh We loves us some autoheader 2005-09-27 23:23:38 +02:00
BUGS Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
ChangeLog Talk about gitweb as well. 2005-09-15 17:19:10 +02:00
configure.in 0.11rc0.GIT 2005-12-06 14:36:32 +01:00
COPYING Clarify the GPL upgrades policy a bit, and propose an addition 2005-09-17 03:33:36 +02:00
features.conf Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
INSTALL Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Makefile Regenerate Makefile.config automatically if config.status has changed. 2005-12-06 14:59:06 +01:00
Makefile.config.in Add rules to check all .c files with sparse 2005-11-24 13:24:19 +01:00
Makefile.lib Slightly adjust the verbose output of the sparse command 2005-11-24 21:54:49 +01:00
NEWS Add simple AsciiDoc markup to NEWS and rework a few entries 2005-10-21 03:38:26 +02:00
README Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
SITES Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
THANKS Initial commit of the HEAD branch of the ELinks CVS repository, as of 2005-09-15 15:58:31 +02:00
TODO Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00

ELinks - an advanced web browser
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ELinks is an advanced and well-established feature-rich text mode web
(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly
customizable and can be extended via scripts. It is very portable and runs
on a variety of platforms.

The ELinks official website is available at

	http://elinks.or.cz/

Please see the SITES file for mirrors or other recommended sites.  If you
want to install ELinks on your computer, see the INSTALL file for further
instructions.

A good start point is documentation files available in doc/, especially the
file named index.txt.

If you want to request features or report bugs, see community information at
http://elinks.or.cz/community.html and feedback information available at
http://elinks.or.cz/feedback.html.

If you want to write some patches, please first read the doc/hacking.txt
document.

If you want to add a new language or update the translation for an existing
one, please read po/README document.

If you want to write some documentation, well, you're welcome! ;)



Historical notes
~~~~~~~~~~~~~~~~

Initially, ELinks was a development version of Links (Lynx-like text WWW
browser), with more liberal features policy and development style.  Its purpose
was to provide an alternative to Links, and to test and tune various new
features, but still provide good rock-solid releases inside stable branches.

Why not contribute to Links instead?  Well, first I made a bunch of patches for
the original Links, but Mikulas wasn't around to integrate them, so I started
releasing my fork. When he came back, a significant number of them got refused
because Mikulas did not like them, as he just wouldn't have any use for them
himself.  He wants to keep Links with a relatively closed feature set and merge
only new features which he himself needs.  It has advantages that the tree is
very narrow and the code is small and contains very little bloat.

ELinks, on the contrary, aims to provide a full-featured web browser, superior
to both lynx and w3m and with the power (but not slowness and memory usage) of
Mozilla, Konqueror and similar browsers. However, to prevent drastic bloating
of the code, the development is driven in the course of modularization and
separation of add-on modules (like cookies, bookmarks, ssl, scripting etc).

For more details about ELinks history, please see

	http://elinks.or.cz/history.html

If you are more interested in the history and various Links clones and versions,
you can examine the website at

	http://links.sf.net/




vim: textwidth=80