[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

One .po file instead of several



I found it easier to work on one .po file when translating d-i instead
of all the small ones.  To make this possible, I wrote the following
script.  It should be executed from the debian-installer directory.
Run

  ./gettext-helper export fr

to extract one fr.po with all the text and all the available french
translations.  Edit the file fr.po to update the translations, and run

  ./gettext-helper import fr

to update or create fr.po in the modules directories.

Please let me know if you find this script useful.

#!/bin/sh
#
# Author: Petter Reinholdtsen <pere@hungry.com>
# Date:   2003-01-17
# Name:   gettext-helper
#
# Combine several .po files into on large file, or spread the
# translations from the large file into the small files.

cmd="$1"
langcode="$2"

pots=`find . -name '*.pot'`
pos=`find . -name "$langcode".po`

case "$cmd" in
    import)
        if test ! -f $langcode.po ; then
	    echo "error: Unable to find $langcode.po.  Aborting."
	    exit 1
	fi
        for pot in $pots ; do
	    echo $pot
	    dir=`dirname $pot`
	    msgmerge -q $langcode.po $pot > $dir/$langcode.po
	    msgfmt --statistics $dir/$langcode.po 2>&1 | sed 's/^/    /'
	done
        ;;
    export)
        msgcat $pots > template.pot.new
	msgcat $pos > $langcode.po.new
	msgmerge $langcode.po.new template.pot.new > $langcode.po
	msgfmt --statistics $langcode.po
	;;
    *)
        echo "error: Unable to understand cmd '$cmd'"
	exit 1
        ;;
esac

exit 0



Reply to: