File: gettext.info, Node: Combining POTs, Prev: xgettext Invocation, Up: Template 5.2 Combining PO Template Files =============================== 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. • This command sequence creates intermediate POT files and then combines them. xgettext -o part-c.pot a.c xgettext -o part-py.pot b.py xgettext -o all.pot part-c.pot part-py.pot • This command sequence does several ‘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 • Likewise here, but a ‘--default-domain’ option is used to denote the output file rather than a ‘-o’ option. 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.
