Previous: Invoking the xgettext
Program, Up: Making the PO Template File [Contents][Index]
When a package contains sources in different programming languages and
different, incompatible xgettext
command line options are required
for these different parts of the package, the solution is to create
intermediate PO template files for each of the parts and then combine (merge)
them together.
For example, assume you have two source files a.c and b.py, and want to extract their translatable strings in separate steps.
Each of the following command sequences does this. The output is the same.
xgettext -o part-c.pot a.c xgettext -o part-py.pot b.py xgettext -o all.pot part-c.pot part-py.pot
xgettext
invocations, with a
single POT file that accumulates the translatable strings.
xgettext -o all.pot a.c xgettext -o all.pot --join-existing b.py
xgettext --default-domain=all a.c xgettext --default-domain=all --join-existing b.py mv all.po all.pot
One might be tempted to think that ‘msgcat’ can do the same thing, through a command sequence such as:
xgettext -o part-c.pot a.c xgettext -o part-py.pot b.py msgcat -o all.pot part-c.pot part-py.pot
But no, this does not work reliably, because sometimes part-c.pot
and part-py.pot
will contain different POT-Creation-Date
values, and msgcat
then produces an all.pot
file that has
conflict markers in the header entry.
This is because msgcat
generally is meant to produce PO files that
are to be reviewed and edited by a translator; this is not desired here.
Previous: Invoking the xgettext
Program, Up: Making the PO Template File [Contents][Index]