summaryrefslogtreecommitdiff
path: root/scripts/update_pot
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/update_pot')
-rwxr-xr-xscripts/update_pot50
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/update_pot b/scripts/update_pot
new file mode 100755
index 000000000..cc94a4009
--- /dev/null
+++ b/scripts/update_pot
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# This script is used for translations using .po files.
+# It updates .pot files after changes in the original English
+# .xml files.
+# The script 'merge_xml' should be run before this script!
+
+if [ "$1" = "--help" ] ; then
+ echo "Usage: $0"
+ exit 0
+fi
+
+if [ -z "`which xml2pot 2>/dev/null`" ] ; then
+ echo "ERR: xml2pot not found, please install the poxml package"
+ exit 1
+fi
+
+BUILDDIR="./build"
+if [ -z "$PO_USEBUILD" ] ; then
+ WORKDIR="./integrated"
+ PODIR="./po"
+else
+ WORKDIR="$BUILDDIR/build.po"
+ PODIR="$BUILDDIR/build.po"
+fi
+SOURCEDIR="$WORKDIR/en"
+RET=0
+
+[ -d $SOURCE ] || exit 1
+mkdir -p $PODIR/pot
+
+# This check is broken!
+if [ -n "$(find $PODIR/pot/ -name *.pot 2>/dev/null)" ] ; then
+ echo "Deleting old POT files..."
+ rm $PODIR/pot/*.pot
+fi
+
+for XML in `find $SOURCEDIR -name "*.xml"` ; do
+ echo "Creating new POT file for $XML"
+ POT=$(basename $XML .xml).pot
+
+ xml2pot $XML >$PODIR/pot/$POT
+ RC=$?
+ if [ $RC -ne 0 ] ; then
+ RET=$RC
+ echo "Error: error $RC while executing xml2pot"
+ fi
+done
+
+exit $RET