1
.\"Generated by db2man.xsl. Don't modify this, modify the source.
10
.de Sp \" Vertical space (when we can't use .PP)
16
.ie \\n(.$>=3 .ne \\$3
20
.TH "XML2PO" 1 "2005/02/10" "" ""
22
xml2po \- program to create a PO-template file from a DocBook XML file and merge it back into a (translated) XML file
27
\fBxml2po\fR [\fBOPTIONS\fR] [\fIXMLFILE\fR]
34
This manual page documents briefly the \fBxml2po\fR command\&.
37
\fBxml2po\fR is a simple Python program which extracts translatable content from free\-form XML documents and outputs gettext compatible POT files\&. Translated PO files can be turned into XML output again\&.
40
It can work it's magic with most "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), "ignored" (skipped over) and "space preserving"\&.
45
The program follows the usual GNU command line syntax, with long options starting with two dashes (`\-')\&. A summary of options is included below\&.
48
\fB\-a\fR, \fB\-\-automatic\-tags\fR
49
Automatically decides if tags are to be considered "final" or not\&.
52
\fB\-k\fR, \fB\-\-keep\-entities\fR
53
Don't expand entities (default)\&. See also the \fB\-e\fR option\&.
56
\fB\-e\fR, \fB\-\-expand\-all\-entities\fR
57
Expand all entities (including SYSTEM ones)\&.
60
\fB\-m\fR, \fB\-\-mode=\fITYPE\fR\fR
61
Treat tags as type \fITYPE\fR (default: docbook)\&.
64
\fB\-o\fR, \fB\-\-output=\fIFILE\fR\fR
65
Print resulting text (XML while merging translations with "\-p" or "\-t" options, POT template file while extracting strings, and translated PO file with "\-r" option) to the given FILE\&.
68
\fB\-p\fR, \fB\-\-po\-file=\fIFILE\fR\fR
69
Specify a PO FILE containing translation and output XML document with translations merged in\&. Using this option will overwrite the temporary file \fI\&.xml2po\&.mo\fR\&.
72
\fB\-r\fR, \fB\-\-reuse=\fIFILE\fR\fR
73
Specify a translated XML document in FILE with the same structure to generate translated PO file for XML document given on command line\&.
76
\fB\-t\fR, \fB\-\-translation=\fIFILE\fR\fR
77
Specify a MO file containing translation and output XML document with translations merged in\&.
80
\fB\-u\fR, \fB\-\-update\-translation=\fILANG\&.po\fR\fR
81
Updates a PO file using \fBmsgmerge\fR\&.
84
\fB\-l\fR, \fB\-\-language=\fILANG\fR\fR
85
Explicitely set language of the translation\&.
88
\fB\-h\fR, \fB\-\-help\fR
89
Show summary of options\&.
92
\fB\-v\fR, \fB\-\-version\fR
93
Show version of program\&.
97
.SS "Creating POT template files"
100
To create a POT template \fIbook\&.pot\fR from an input file \fIbook\&.xml\fR, which consists of \fIchapter1\&.xml\fR and \fIchapter2\&.xml\fR (external entities), run:
104
\fB/usr/bin/xml2po\fR \fB\-o\fR book\&.pot book\&.xml chapter1\&.xml chapter2\&.xml
109
To expand entities use the \fB\-e\fR option:
113
\fB/usr/bin/xml2po\fR \fB\-e \-o\fR book\&.pot book\&.xml
117
.SS "Creating translated XML files (merging back PO files)"
120
After translating \fIbook\&.pot\fR into \fILANG\&.po\fR, merge the translations back by using \fB\-p\fR option for each XML file:
124
\fB/usr/bin/xml2po\fR \fB\-p\fR LANG\&.po \fB\-o\fR book\&.LANG\&.xml book\&.xml
125
\fB/usr/bin/xml2po\fR \fB\-p\fR LANG\&.po \fB\-o\fR chapter1\&.LANG\&.xml chapter1\&.xml
126
\fB/usr/bin/xml2po\fR \fB\-p\fR LANG\&.po \fB\-o\fR chapter2\&.LANG\&.xml chapter2\&.xml
131
If you used the \fB\-e\fR option to expand entities, you should use it again to merge back the translation into an XML file:
135
\fB/usr/bin/xml2po\fR \fB\-e \-p\fR LANG\&.po \fB\-o\fR book\&.LANG\&.xml book\&.xml
139
.SS "Updating PO files"
142
When base XML file changes, the real advantages of PO files come to surface\&. There are 2 ways to merge the translation\&. The first is to produce a new POT template file (additionally use the \fB\-e\fR if you decided earlier to expand entities)\&. Afterwards run \fBmsgmerge\fR to merge the translation with the new POT file:
146
\fB/usr/bin/msgmerge\fR \fB\-o\fR tmp\&.po LANG\&.po book\&.pot
151
Now rename \fItmp\&.po\fR to \fILANG\&.po\fR and update your translation\&. Alternatively, \fBxml2po\fR provides the \fB\-u\fR option, which does exactly these two steps for you\&. The advantage is, that it also runs \fBmsgfmt\fR to give you a statistical output of translation status (count of translated, untranslated and fuzzy messages)\&. Additionally use the \fB\-e\fR if you decided earlier to expand entities:
155
\fB/usr/bin/xml2po\fR \fB\-u\fR LANG\&.po book\&.xml
162
\fBmsgmerge\fR (1), \fBmsgfmt\fR (1)
167
This manual page was written by Daniel Leidert <daniel\&.leidert@wgdd\&.de> for the Debian system (but may be used by others)\&. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation\&.