www.delorie.com/gnu/docs/gettext/gettext_61.html   search  
Buy GNU books!

GNU gettext utilities

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Manipulating PO Files

Sometimes it is necessary to manipulate PO files in a way that is better performed automatically than by hand. GNU gettext includes a complete set of tools for this purpose.

When merging two packages into a single package, the resulting POT file will be the concatenation of the two packages' POT files. Thus the maintainer must concatenate the two existing package translations into a single translation catalog, for each language. This is best performed using `msgcat'. It is then the translators' duty to deal with any possible conflicts that arose during the merge.

When a translator takes over the translation job from another translator, but she uses a different character encoding in her locale, she will convert the catalog to her character encoding. This is best done through the `msgconv' program.

When a maintainer takes a source file with tagged messages from another package, he should also take the existing translations for this source file (and not let the translators do the same job twice). One way to do this is through `msggrep', another is to create a POT file for that source file and use `msgmerge'.

When a translator wants to adjust some translation catalog for a special dialect or orthography -- for example, German as written in Switzerland versus German as written in Germany -- she needs to apply some text processing to every message in the catalog. The tool for doing this is `msgfilter'.

Another use of msgfilter is to produce approximately the POT file for which a given PO file was made. This can be done through a filter command like `msgfilter sed -e d | sed -e '/^# /d''. Note that the original POT file may have had different comments and different plural message counts, that's why it's better to use the original POT file if available.

When a translator wants to check her translations, for example according to orthography rules or using a non-interactive spell checker, she can do so using the `msgexec' program.

When third party tools create PO or POT files, sometimes duplicates cannot be avoided. But the GNU gettext tools give an error when they encounter duplicate msgids in the same file and in the same domain. To merge duplicates, the `msguniq' program can be used.

`msgcomm' is a more general tool for keeping or throwing away duplicates, occurring in different files.

`msgcmp' can be used to check whether a translation catalog is completely translated.

`msgattrib' can be used to select and extract only the fuzzy or untranslated messages of a translation catalog.

`msgen' is useful as a first step for preparing English translation catalogs. It copies each message's msgid to its msgstr.

7.1 Invoking the msgcat Program  
7.2 Invoking the msgconv Program  
7.3 Invoking the msggrep Program  
7.4 Invoking the msgfilter Program  
7.5 Invoking the msguniq Program  
7.6 Invoking the msgcomm Program  
7.7 Invoking the msgcmp Program  
7.8 Invoking the msgattrib Program  
7.9 Invoking the msgen Program  
7.10 Invoking the msgexec Program  

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003