summaryrefslogtreecommitdiff
path: root/scripts/update_pot
blob: cc94a4009690d87c9e7b8809b87aaed18cee682c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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