gettext: Manipulating

1 
1 9 Manipulating PO Files
1 ***********************
1 
1    Sometimes it is necessary to manipulate PO files in a way that is
1 better performed automatically than by hand.  GNU ‘gettext’ includes a
1 complete set of tools for this purpose.
1 
1    When merging two packages into a single package, the resulting POT
1 file will be the concatenation of the two packages’ POT files.  Thus the
1 maintainer must concatenate the two existing package translations into a
1 single translation catalog, for each language.  This is best performed
1 using ‘msgcat’.  It is then the translators’ duty to deal with any
1 possible conflicts that arose during the merge.
1 
1    When a translator takes over the translation job from another
1 translator, but she uses a different character encoding in her locale,
1 she will convert the catalog to her character encoding.  This is best
1 done through the ‘msgconv’ program.
1 
1    When a maintainer takes a source file with tagged messages from
1 another package, he should also take the existing translations for this
1 source file (and not let the translators do the same job twice).  One
1 way to do this is through ‘msggrep’, another is to create a POT file for
1 that source file and use ‘msgmerge’.
1 
1    When a translator wants to adjust some translation catalog for a
1 special dialect or orthography — for example, German as written in
1 Switzerland versus German as written in Germany — she needs to apply
1 some text processing to every message in the catalog.  The tool for
1 doing this is ‘msgfilter’.
1 
1    Another use of ‘msgfilter’ is to produce approximately the POT file
1 for which a given PO file was made.  This can be done through a filter
1 command like ‘msgfilter sed -e d | sed -e '/^# /d'’.  Note that the
1 original POT file may have had different comments and different plural
1 message counts, that’s why it’s better to use the original POT file if
1 available.
1 
1    When a translator wants to check her translations, for example
1 according to orthography rules or using a non-interactive spell checker,
1 she can do so using the ‘msgexec’ program.
1 
1    When third party tools create PO or POT files, sometimes duplicates
1 cannot be avoided.  But the GNU ‘gettext’ tools give an error when they
1 encounter duplicate msgids in the same file and in the same domain.  To
1 merge duplicates, the ‘msguniq’ program can be used.
1 
1    ‘msgcomm’ is a more general tool for keeping or throwing away
1 duplicates, occurring in different files.
1 
1    ‘msgcmp’ can be used to check whether a translation catalog is
1 completely translated.
1 
1    ‘msgattrib’ can be used to select and extract only the fuzzy or
1 untranslated messages of a translation catalog.
1 
1    ‘msgen’ is useful as a first step for preparing English translation
1 catalogs.  It copies each message’s msgid to its msgstr.
1 
1    Finally, for those applications where all these various programs are
1 not sufficient, a library ‘libgettextpo’ is provided that can be used to
1 write other specialized programs that process PO files.
1 

Menu