From 1ea73eea5ecc6a8ed901316049259aee737ee554 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 Oct 2005 19:51:38 +0000 Subject: move manual to top-level directory, split out of debian-installer package --- scripts/update_po | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 scripts/update_po (limited to 'scripts/update_po') 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 " + 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 -- cgit v1.2.3