diff options
author | Joey Hess <joeyh@debian.org> | 2005-10-07 19:51:38 +0000 |
---|---|---|
committer | Joey Hess <joeyh@debian.org> | 2005-10-07 19:51:38 +0000 |
commit | 1ea73eea5ecc6a8ed901316049259aee737ee554 (patch) | |
tree | 03a077f0b1b1548f3c806bd1c5795964fba0fb52 /scripts/update_po | |
download | installation-guide-1ea73eea5ecc6a8ed901316049259aee737ee554.zip |
move manual to top-level directory, split out of debian-installer package
Diffstat (limited to 'scripts/update_po')
-rwxr-xr-x | scripts/update_po | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/scripts/update_po b/scripts/update_po new file mode 100755 index 000000000..9432c7659 --- /dev/null +++ b/scripts/update_po @@ -0,0 +1,58 @@ +#!/bin/sh + +# This script is used for translations using .po files. +# It updates .po files after changes in the original English +# .xml files. +# The scripts 'merge_xml' and 'update-pot' should be run before +# this script! + +if [ "$1" = "--help" ] ; then + echo "Usage: $0 <language>" + exit 0 +fi +if [ -z "`which msgmerge 2>/dev/null`" ] ; then + echo "ERR: Msgmerge not found, please install the gettext package" + exit 1 +fi + +language=${1:-pl} + +SPODIR="./po" +BUILDDIR="./build" +if [ -z "$PO_USEBUILD" ] ; then + PODIR=$SPODIR +else + PODIR="$BUILDDIR/build.po" + mkdir -p $PODIR/$language +fi +RET=0 + +[ -d "$PODIR" ] || exit 1 + +echo "Updating PO files for language '$language':" +for POT in `find $PODIR/pot -name "*.pot"` ; do + BASENAME="$(basename $POT .pot)" + PO=$PODIR/$language/$BASENAME.po + SPO=$SPODIR/$language/$BASENAME.po + + if [ -f $SPO ] ; then + echo "- updating $BASENAME.po" + if [ -z "$PO_USEBUILD" ] ; then + # Update existing PO file + msgmerge -q -U --backup=simple $PO $POT + RC=$? + else + # Generate temporary PO file in build directory + msgmerge -q $SPO $POT -o $PO + RC=$? + fi + if [ $RC -ne 0 ] ; then + RET=$RC + echo "Error: error $RC while executing msgmerge" + fi + else + echo "Warning: no PO file found for '$BASENAME'." + fi +done + +exit $RET |