1
.TH XML2PO 1 2005/02/10
3
xml2po \- program to create a PO\-template file from a DocBook XML file and merge it back into a (translated) XML file
5
\fBxml2po\fR [\fBOPTIONS\fR] [\fBXMLFILE\fR]
7
This manual page documents briefly the xml2po
10
xml2po is a simple Python program which extracts
11
translatable content from free\-form XML documents and outputs gettext
12
compatible POT files. Translated PO files can be turned into XML output
15
It can work it's magic with most "simple" tags, and for complicated
16
tags one has to provide a list of all tags which are "final" (that
17
will be put into one "message" in PO file), "ignored" (skipped over)
18
and "space preserving".
20
The program follows the usual GNU command line syntax,
21
with long options starting with two dashes (`\-'). A summary of
22
options is included below.
24
\fB\-a\fR, \fB\-\-automatic\-tags\fR
25
Automatically decides if tags are to be considered
28
\fB\-k\fR, \fB\-\-keep\-entities\fR
29
Don't expand entities (default). See also the \fB\-e\fR
32
\fB\-e\fR, \fB\-\-expand\-all\-entities\fR
33
Expand all entities (including SYSTEM ones).
35
\fB\-m\fR, \fB\-\-mode=\fITYPE\fB\fR
36
Treat tags as type \fITYPE\fR
39
\fB\-o\fR, \fB\-\-output=\fIFILE\fB\fR
40
Print resulting text (XML or POT) to the given file.
42
\fB\-p\fR, \fB\-\-po\-file=\fIFILE\fB\fR
43
Specify PO file containing translation, and merge.
44
Using this option will overwrites the temporary
45
file \fB.xml2po.mo\fR.
47
\fB\-r\fR, \fB\-\-reuse=\fIFILE\fB\fR
48
Specify a translated XML file with the same structure ...
50
\fB\-t\fR, \fB\-\-translation=\fIFILE\fB\fR
51
Specify a MO file containing translation and merge it with ...
53
\fB\-u\fR, \fB\-\-update\-translation=\fILANG.po\fB\fR
54
Updates a PO file using msgmerge.
56
\fB\-h\fR, \fB\-\-help\fR
57
Show summary of options.
59
\fB\-v\fR, \fB\-\-version\fR
60
Show version of program.
62
.SS "CREATING POT TEMPLATE FILES"
63
To create a POT template \fBbook.pot\fR from an input
64
file \fBbook.xml\fR, which consists
66
and \fBchapter2.xml\fR (external entities), run:
70
/usr/bin/xml2po \fB\-o\fR book.pot book.xml chapter1.xml chapter2.xml
74
To expand entities use the \fB\-e\fR option:
78
/usr/bin/xml2po \fB\-e \-o\fR book.pot book.xml
81
.SS "CREATING TRANSLATED XML FILES (MERGING BACK PO FILES)"
82
After translating \fBbook.pot\fR
83
into \fBLANG.po\fR, merge the translations back by
84
using \fB\-p\fR option for each XML file:
88
/usr/bin/xml2po \fB\-p\fR LANG.po \fB\-o\fR book.LANG.xml book.xml
89
/usr/bin/xml2po \fB\-p\fR LANG.po \fB\-o\fR chapter1.LANG.xml chapter1.xml
90
/usr/bin/xml2po \fB\-p\fR LANG.po \fB\-o\fR chapter2.LANG.xml chapter2.xml
94
If you used the \fB\-e\fR option to expand entities,
95
you should use it again to merge back the translation into an XML file:
99
/usr/bin/xml2po \fB\-e \-p\fR LANG.po \fB\-o\fR book.LANG.xml book.xml
102
.SS "UPDATING PO FILES"
103
When base XML file changes, the real advantages of PO files come to
104
surface. There are 2 ways to merge the translation. The first is to
105
produce a new POT template file (additionally use
106
the \fB\-e\fR if you decided earlier to expand
107
entities). Afterwards run msgmerge to merge the
108
translation with the new POT file:
112
/usr/bin/msgmerge \fB\-o\fR tmp.po LANG.po book.pot
116
Now rename \fBtmp.po\fR to \fBLANG.po\fR and
117
update your translation. Alternatively, xml2po
118
provides the \fB\-u\fR option, which does exactly these two steps for
119
you. The advantage is, that it also runs msgfmt to give you
120
a statistical output of translation status (untranslated, fuzzy, ...). Additionally
121
use the \fB\-e\fR if you decided earlier to expand entities:
125
/usr/bin/xml2po \fB\-u\fR LANG.po book.xml
129
msgmerge (1), msgfmt (1)
131
This manual page was written by Daniel Leidert daniel.leidert@wgdd.de for
132
the Debian system (but may be used by others). Permission is
133
granted to copy, distribute and/or modify this document under
134
the terms of the GNU General Public License, Version 2 any
135
later version published by the Free Software Foundation.