[PATCH] Support of PO files for translations

C. Michael Pilato cmpilato at red-bean.com
Wed Sep 17 20:09:41 CDT 2008

Jens Seidel wrote:
> Hi,
> as announced long time ago I worked on proper PO file support for handling
> translations of the book. PO files are the standard way (see e.g.
> http://www.debian.org/intl/l10n/po/) in the Open Source community to work on
> translations and is used among others by Subversion.
> Currently all translations are based on XML files. This has many
> disadvantages:
>  * Keep the files in sync with English ones is *very* hard
>  * There is no standard way to specify the sync state against English files
>    (needs to be extracted from svn log or maybe a comment, and is often wrong!)
>  * There are from time to time build failures because tags where wrongly
>    used in translations or not all XML files are in sync with the English ones
>  * There are many long XML tags which need to be used in translations as well
>  * If the translation is not yet fully updated after beeing 100% in the
>    past old and new texts are mixed
>  * Many (small) strings are repeated over and over again and need to be
>    translated multiple times
>  * It's not possible to add common translations for smaller phrases
>    from an external message catalog
>  * No way to get translation statistics
> Nearly all these disadvantages are solved by using PO files.

Jens, what is the state of the art with respect to XML-to-PO file generation
(and back)?  It seems to me (and I admit ignorance on this topic) that there
are two steps to moving from today's scenario to a more ideal one where
translation teams need only upgrade PO files:

   1. First, convert the existing XML into something "gettext-ized"  I
      don't know what this looks like, but maybe its:

         <sect1 ...>
           <title>_(Version Control with Subversion)</title>
           <para>_(This is a sentence.)
           _(This is another sentence.)
           _(And a third!)</para>

      Or maybe you do whole paragraphs at a time:

         <sect1 ...>
           <title>_(Version Control with Subversion)</title>
           <para>_(This is a sentence.  This is another sentence.
           And a third!)</para>

       And then use PO-generation and maintenance tools, just like the
       Subversion source code does.

   2.  Secondly, you use automated tools to generate PO files from the
       "gettext-ized" XML sources.

Is this right?

If so, then I'd like to know the options for that first step.  Is it a
one-time operation that we'd perform and then the English authors would be
working in gettext-ized XML from now on?  Or is it the kind of thing that,
say, a nightly cron job could generate from the current English XML sources
and commit nightly to the repository?

C. Michael Pilato <cmpilato at red-bean.com> | http://cmpilato.blogspot.com/

More information about the svnbook-dev mailing list