gettext: Creating Compendia
1
1 8.4.1 Creating Compendia
1 ------------------------
1
1 Basically every PO file consisting of translated entries only can be
1 declared as a valid compendium. Often the translator wants to have
1 special compendia; let’s consider two cases: ‘concatenating PO files’
1 and ‘extracting a message subset from a PO file’.
1
1 8.4.1.1 Concatenate PO Files
1 ............................
1
1 To concatenate several valid PO files into one compendium file you
1 can use ‘msgcomm’ or ‘msgcat’ (the latter preferred):
1
1 msgcat -o compendium.po file1.po file2.po
1
1 By default, ‘msgcat’ will accumulate divergent translations for the
1 same string. Those occurrences will be marked as ‘fuzzy’ and highly
1 visible decorated; calling ‘msgcat’ on ‘file1.po’:
1
1 #: src/hello.c:200
1 #, c-format
1 msgid "Report bugs to <%s>.\n"
1 msgstr "Comunicar `bugs' a <%s>.\n"
1
1 and ‘file2.po’:
1
1 #: src/bye.c:100
1 #, c-format
1 msgid "Report bugs to <%s>.\n"
1 msgstr "Comunicar \"bugs\" a <%s>.\n"
1
1 will result in:
1
1 #: src/hello.c:200 src/bye.c:100
1 #, fuzzy, c-format
1 msgid "Report bugs to <%s>.\n"
1 msgstr ""
1 "#-#-#-#-# file1.po #-#-#-#-#\n"
1 "Comunicar `bugs' a <%s>.\n"
1 "#-#-#-#-# file2.po #-#-#-#-#\n"
1 "Comunicar \"bugs\" a <%s>.\n"
1
1 The translator will have to resolve this “conflict” manually; she has to
1 decide whether the first or the second version is appropriate (or
1 provide a new translation), to delete the “marker lines”, and finally to
1 remove the ‘fuzzy’ mark.
1
1 If the translator knows in advance the first found translation of a
1 message is always the best translation she can make use to the
1 ‘--use-first’ switch:
1
1 msgcat --use-first -o compendium.po file1.po file2.po
1
1 A good compendium file must not contain ‘fuzzy’ or untranslated
1 entries. If input files are “dirty” you must preprocess the input files
1 or postprocess the result using ‘msgattrib --translated --no-fuzzy’.
1
1 8.4.1.2 Extract a Message Subset from a PO File
1 ...............................................
1
1 Nobody wants to translate the same messages again and again; thus you
1 may wish to have a compendium file containing ‘getopt.c’ messages.
1
1 To extract a message subset (e.g., all ‘getopt.c’ messages) from an
1 existing PO file into one compendium file you can use ‘msggrep’:
1
1 msggrep --location src/getopt.c -o compendium.po file.po
1