[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Translating NEWS.Debian files: a (crude) first try


I just commited two new modules to the cvs of the po4a project (on alioth).

The first one (NewsDebian.pm) is good to extract/translate debian
changelogs. Its main goal is to deal with the "NEWS.Debian" files. They
follow the "debian changelog" format explained in the policy and are where
the developper should put the important news about their package. Such as
"conf file moved" or "semantic changed" or such. They are then parsed by
apt-listchanges before the installation and the user is given the ability to
refuse the upgrade if those news are too bad.

Since a long time, we try to get those files translated, but the way to do
so was not clear. 

I decided to distribute a bunch of files in the package, each called
NEWS.Debian.<lang code>. This has the advantage of not breaking the existing
softwares (precious when acting so close from a release). In other words, I
assume that apt-listchanges will choose which file to display depending on
the user's locale.

To generate those files, I naturally decided to use po4a and thus wrote this

The next issue to solve was to that po-debconf uses the debian/po directory,
which I thus have to share with him. I decided not to share anything and
play an embrace&extend game (*). The second module tries to do the
po-debconf work of extraction. It is not really tested, but it's already too
late. Let's assume it works for now and take is as a proof of concept.

(*): remember that po-debconf was done by Denis and that po4a is done by
     Denis, Jordi, Nekral and me ;)

Now, we could add po4a.conf files in each package like this:
# first explain where are the transaltor input files
[po4a_paths] debian/po/debian.pot fr:debian/po/fr.po \
                                  de:debian/po/de.po \

# Then list the document to translate, their format, their translations
[type: debconf] templates 
[type: newsdebian] debian/README.Debian fr:tmp/DEBIAN/README.Debian.fr \
                                        de:tmp/DEBIAN/README.Debian.de \

and then add an invocation to po4a -f debian/po4a.conf to debian/rules and
we're set.

At least that's the plan. Some comments before I fall asleep:

 * I did almost no testing.
 * the Debconf module is unable to generate template files for now.

   The core of po4a in unable to put more than one translation in each
   produced document, but this is mandatory for debconf.
   The way I want to use to solve it is described at the end of the
   Locale::Po4a::TransTractor man page. The module already takes this path.
   Intead of calling $self->pushline($self->translate()) directly, it put
   those calls into a string which could be eval()uated in a loop for each
   language. [sorry for the one not knowing the po4a internals, I just
   wanted to explain the others]

   But we could use po4a for extraction (to get the right content into
   debian/po) and po-debconf for template generation (to get the right
   content into the package) without problems [that I could predict ;]

 * the NewsDebian is not really cleaver and put each entry into one msgid in
   no-wrap mode without trying to split each points. Example:

   # type: dictd (1.9.11-1) unstable; urgency=low
   #: dict:20
   #, no-wrap
   msgid ""
   "  * dict.conf has moved from /etc to /etc/dictd.\n"
   "  * The plugin shared libraries and example plugins are nolonger\n"
   "    shipped with the dictd binary.  If you wish to experiment with\n"
   "    plugins see /usr/share/doc/dictd/README.Plugins.gz.\n"
   msgstr ""

   Well, those files are not supposed to change *at all*, actually. And the
   format within each entry is not completely fixed and maintainers sometimes
   take some liberty. I wanted to play safe. 
That's pretty much it, I guess.

Attachment: signature.asc
Description: Digital signature

Reply to: