November 07, 2004 11:31 PM

l10n@2.0: generating PO files from POT files

For translating we are generating POT files. See POT files from milestones (FIXME: this will be mirrored to *

How to get PO files from them? Some people prefer to use kbabel or other tools. But I simply do not believe them ;-)

I have prepared script that can be used to generate PO files from the above mentioned POT files. So let's start with it:

# This script can be used to generate PO files from POT
# files.
# Compendium generated from old PO files
# If you do not have compendium or you want to start from scratch ;-)
# COMPENDIUM=/dev/null
rm -rf PO
for POT in `find POT -type f`
   PO=`echo $POT|sed 's#POT#PO#'|sed 's#.pot#.po#'`
   echo $PO
   # Create directory for new PO file
   mkdir -p `dirname $PO`
   msginit --no-translator -i $POT -o $PO
   msgmerge --backup=off -w 200 -U --compendium=$COMPENDIUM $PO $POT
It is pretty simple. It expects POT files unpacked in the POT directory and will remove and create PO directory with clean PO files from them. If you already have a database of translated strings in the form of PO file, you can define COMPENDIUM variable to point to it. If you define it, PO files will be initiated with already existing translations.

The next entry (it will be written tomorrow, for sure!) will be about generating GSI/SDF file from translated PO files. So stay tuned, because project can accept submissions of translations in the GSI/SDF format only (which you must use for your localized builds anyway). -----

Posted by Pavel | Permanent link | File under: