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