xml2po 1.0.2 — © 2004, Danilo Segan

Requirements
............

 * Python
 * libxml2 and libxml2-python
 * xml2po.py

About xml2po
............

xml2po is a simple Python program which extracts translatable content
from free-form XML documents and outputs gettext compatible POT
files.

It can work it's magic only with simple tags, and for complicated
tags one has to provide a list of all tags which are "final" (that
will be put into one "message" in PO file).

I will try to provide sane defaults for DocBook documents, but one
would have to provide more suitable definitions for other kinds of
documents in files "ignored-tags" and "final-tags" in the directory
xml2po is run in, or with filenames passed as -i and -f options.

Ignored tags are those that will be silently skipped over, and not
recursed into.

Preparing a POTemplate from XML file
........................................

 ./xml2po.py file.xml > template.pot

You may use parameters '-f final-tags' and '-i ignored-tags', where
file final-tags and ignored-tags contain one-tag-per-line, and first 
are considered "final" (i.e. do not recurse over its children), and
latter are ignored (including its children).  If you do not use -f or
-i parameters, default is to read files "final-tags" and
"ignored-tags" from current working directory.

You may want to add "link" tag to ignored-tags.

Get back a translation from a translator
........................................

Save a translation to xx.po, where xx is language code of a
translation (i.e. "sr" for Serbian, "de" for German, ...).

Execute:
 msgfmt -v -o xx.gmo xx.po
 ./xml2po.py -m -t xx.gmo file.xml > file-xx.xml

Now you've got a nice and translated XML file in 'file-xx.xml'.


Lists of tags
.............

Files "ignore-tags" and "final-tags" contain lists of tags which are
treated specially.  If tag is in the ignore-tags list, *AND* not in
the final-tags list, it is completely ignored (skipped over).  If
it's in both lists, it is processed, but corresponding message for
translation won't be output (useful for things like "itemizedlist"
which don't have any content for translation).  If a tag is only in
final-tags, it is considered to be the general translateable unit,
and it is output as one message into the PO file, except if it
contains other final-tags (eg. para containing another para), when
that nesting final tag is replaced with a string of the form
"<placeholder-2>".
