Next: , Up: Using Translation Compendia   [Contents][Index]

8.4.1 Creating Compendia

Basically every PO file consisting of translated entries only can be declared as a valid compendium. Often the translator wants to have special compendia; let’s consider two cases: concatenating PO files and extracting a message subset from a PO file. Concatenate PO Files

To concatenate several valid PO files into one compendium file you can use ‘msgcomm’ or ‘msgcat’ (the latter preferred):

msgcat -o compendium.po file1.po file2.po

By default, msgcat will accumulate divergent translations for the same string. Those occurrences will be marked as fuzzy and highly visible decorated; calling msgcat on file1.po:

#: src/hello.c:200
#, c-format
msgid "Report bugs to <%s>.\n"
msgstr "Comunicar `bugs' a <%s>.\n"

and file2.po:

#: src/bye.c:100
#, c-format
msgid "Report bugs to <%s>.\n"
msgstr "Comunicar \"bugs\" a <%s>.\n"

will result in:

#: src/hello.c:200 src/bye.c:100
#, fuzzy, c-format
msgid "Report bugs to <%s>.\n"
msgstr ""
"#-#-#-#-#  file1.po  #-#-#-#-#\n"
"Comunicar `bugs' a <%s>.\n"
"#-#-#-#-#  file2.po  #-#-#-#-#\n"
"Comunicar \"bugs\" a <%s>.\n"

The translator will have to resolve this “conflict” manually; she has to decide whether the first or the second version is appropriate (or provide a new translation), to delete the “marker lines”, and finally to remove the fuzzy mark.

If the translator knows in advance the first found translation of a message is always the best translation she can make use to the ‘--use-first’ switch:

msgcat --use-first -o compendium.po file1.po file2.po

A good compendium file must not contain fuzzy or untranslated entries. If input files are “dirty” you must preprocess the input files or postprocess the result using ‘msgattrib --translated --no-fuzzy’. Extract a Message Subset from a PO File

Nobody wants to translate the same messages again and again; thus you may wish to have a compendium file containing getopt.c messages.

To extract a message subset (e.g., all getopt.c messages) from an existing PO file into one compendium file you can use ‘msggrep’:

msggrep --location src/getopt.c -o compendium.po file.po

Next: Using Compendia, Up: Using Translation Compendia   [Contents][Index]