1XML2PO(1)                                                            XML2PO(1)
2
3
4

NAME

6       xml2po - program to create a PO-template file from a DocBook XML file
7       and merge it back into a (translated) XML file
8

SYNOPSIS

10       xml2po [OPTIONS] [XMLFILE]
11

DESCRIPTION

13       This manual page documents briefly the xml2po command.
14
15       xml2po is a simple Python program which extracts translatable content
16       from free-form XML documents and outputs gettext compatible POT files.
17       Translated PO files can be turned into XML output again.
18
19       It can work it's magic with most "simple" tags, and for complicated
20       tags one has to provide a list of all tags which are "final" (that will
21       be put into one "message" in PO file), "ignored" (skipped over) and
22       "space preserving".
23

OPTIONS

25       The program follows the usual GNU command line syntax, with long
26       options starting with two dashes (`-'). A summary of options is
27       included below.
28
29       -a, --automatic-tags
30              Automatically decides if tags are to be considered "final" or
31              not.
32
33       -k, --keep-entities
34              Don't expand entities (default). See also the -e option.
35
36       -e, --expand-all-entities
37              Expand all entities (including SYSTEM ones).
38
39       -m, --mode=TYPE
40              Treat tags as type TYPE (default: docbook).
41
42       -o, --output=FILE
43              Print resulting text (XML while merging translations with "-p"
44              or "-t" options, POT template file while extracting strings, and
45              translated PO file with "-r" option) to the given FILE.
46
47       -p, --po-file=FILE
48              Specify a PO FILE containing translation and output XML document
49              with translations merged in. Using this option will overwrite
50              the temporary file .xml2po.mo.
51
52       -r, --reuse=FILE
53              Specify a translated XML document in FILE with the same
54              structure to generate translated PO file for XML document given
55              on command line.
56
57       -t, --translation=FILE
58              Specify a MO file containing translation and output XML document
59              with translations merged in.
60
61       -u, --update-translation=LANG.po
62              Updates a PO file using msgmerge.
63
64       -l, --language=LANG
65              Explicitely set language of the translation.
66
67       -h, --help
68              Show summary of options.
69
70       -v, --version
71              Show version of program.
72

EXAMPLES

74   Creating POT template files
75       To create a POT template book.pot from an input file book.xml, which
76       consists of chapter1.xml and chapter2.xml (external entities), run:
77
78                           /usr/bin/xml2po -o book.pot book.xml chapter1.xml chapter2.xml
79
80
81       To expand entities use the -e option:
82
83                           /usr/bin/xml2po -e -o book.pot book.xml
84
85
86   Creating translated XML files (merging back PO files)
87       After translating book.pot into LANG.po, merge the translations back by
88       using -p option for each XML file:
89
90                           /usr/bin/xml2po -p LANG.po -o book.LANG.xml book.xml
91                           /usr/bin/xml2po -p LANG.po -o chapter1.LANG.xml chapter1.xml
92                           /usr/bin/xml2po -p LANG.po -o chapter2.LANG.xml chapter2.xml
93
94
95       If you used the -e option to expand entities, you should use it again
96       to merge back the translation into an XML file:
97
98                           /usr/bin/xml2po -e -p LANG.po -o book.LANG.xml book.xml
99
100
101   Updating PO files
102       When base XML file changes, the real advantages of PO files come to
103       surface. There are 2 ways to merge the translation. The first is to
104       produce a new POT template file (additionally use the -e if you decided
105       earlier to expand entities). Afterwards run msgmerge to merge the
106       translation with the new POT file:
107
108                           /usr/bin/msgmerge -o tmp.po LANG.po book.pot
109
110
111       Now rename tmp.po to LANG.po and update your translation.
112       Alternatively, xml2po provides the -u option, which does exactly these
113       two steps for you. The advantage is, that it also runs msgfmt to give
114       you a statistical output of translation status (count of translated,
115       untranslated and fuzzy messages). Additionally use the -e if you
116       decided earlier to expand entities:
117
118                           /usr/bin/xml2po -u LANG.po book.xml
119
120

SEE ALSO

122       msgmerge (1), msgfmt (1)
123

AUTHOR

125       This manual page was written by Daniel Leidert <daniel.leidert@wgdd.de>
126       for the Debian system (but may be used by others). Permission is
127       granted to copy, distribute and/or modify this document under the terms
128       of the GNU General Public License, Version 2 any later version
129       published by the Free Software Foundation.
130
131
132
133                                  2005/02/10                         XML2PO(1)
Impressum