1XML2PO(1) [FIXME: manual] XML2PO(1)
2
3
4
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
10 xml2po [OPTIONS] [XMLFILE]
11
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
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 decide if tags are to be considered "final" or not.
31
32 -k, --keep-entities
33 Don´t expand entities (default). See also the -e option.
34
35 -e, --expand-all-entities
36 Expand all entities (including SYSTEM ones).
37
38 -m, --mode=TYPE
39 Treat tags as type TYPE (default: docbook).
40
41 -o, --output=FILE
42 Print resulting text (XML while merging translations with "-p" or
43 "-t" options, POT template file while extracting strings, and
44 translated PO file with "-r" option) to the given FILE.
45
46 -p, --po-file=FILE
47 Specify a PO FILE containing translation and output XML document
48 with translations merged in. Using this option will overwrite the
49 temporary file .xml2po.mo.
50
51 -r, --reuse=FILE
52 Specify a translated XML document in FILE with the same structure
53 to generate translated PO file for XML document given on command
54 line.
55
56 -t, --translation=FILE
57 Specify a MO file containing translation and output XML document
58 with translations merged in.
59
60 -u, --update-translation=LANG.po
61 Update a PO file using msgmerge.
62
63 -l, --language=LANG
64 Explicitly set language of the translation.
65
66 -h, --help
67 Show summary of options.
68
69 -v, --version
70 Show version of program.
71
73 Creating POT template files
74 To create a POT template book.pot from an input file book.xml, which
75 consists of chapter1.xml and chapter2.xml (external entities), run:
76
77 /usr/bin/xml2po -o book.pot book.xml chapter1.xml chapter2.xml
78
79
80 To expand entities use the -e option:
81
82 /usr/bin/xml2po -e -o book.pot book.xml
83
84
85 Creating translated XML files (merging back PO files)
86 After translating book.pot into LANG.po, merge the translations back by
87 using -p option for each XML file:
88
89 /usr/bin/xml2po -p LANG.po -o book.LANG.xml book.xml
90 /usr/bin/xml2po -p LANG.po -o chapter1.LANG.xml chapter1.xml
91 /usr/bin/xml2po -p LANG.po -o chapter2.LANG.xml chapter2.xml
92
93
94 If you used the -e option to expand entities, you should use it again
95 to merge back the translation into an XML file:
96
97 /usr/bin/xml2po -e -p LANG.po -o book.LANG.xml book.xml
98
99
100 Updating PO files
101 When base XML file changes, the real advantages of PO files come to
102 surface. There are 2 ways to merge the translation. The first is to
103 produce a new POT template file (additionally use the -e if you decided
104 earlier to expand entities). Afterwards run msgmerge to merge the
105 translation with the new POT file:
106
107 /usr/bin/msgmerge -o tmp.po LANG.po book.pot
108
109
110 Now rename tmp.po to LANG.po and update your translation.
111 Alternatively, xml2po provides the -u option, which does exactly these
112 two steps for you. The advantage is, that it also runs msgfmt to give
113 you a statistical output of translation status (count of translated,
114 untranslated and fuzzy messages). Additionally use the -e if you
115 decided earlier to expand entities:
116
117 /usr/bin/xml2po -u LANG.po book.xml
118
119
121 msgmerge (1), msgfmt (1)
122
124 This manual page was written by Daniel Leidert daniel.leidert@wgdd.de
125 for the Debian system (but may be used by others). Permission is
126 granted to copy, distribute and/or modify this document under the terms
127 of the GNU General Public License, Version 2 any later version
128 published by the Free Software Foundation.
129
131 Copyright © 2005 Daniel Leidert
132
133
134
135[FIXME: source] 2005/02/10 XML2PO(1)