/[d-i]/trunk/manual/scripts/update_pot
ViewVC logotype

Contents of /trunk/manual/scripts/update_pot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33609 - (show annotations) (download)
Sun Jan 1 12:07:02 2006 UTC (7 years, 4 months ago) by fjp
File size: 1491 byte(s)
Add check to avoid errors
1 #!/bin/sh
2
3 # This script is used for translations using .po files.
4 # It updates .pot files after changes in the original English
5 # .xml files.
6 # The script 'merge_xml' should be run before this script!
7
8 if [ "$1" = "--help" ] ; then
9 echo "Usage: $0"
10 exit 0
11 fi
12
13 if [ -z "`which xml2pot 2>/dev/null`" ] ; then
14 echo "ERR: xml2pot not found, please install the poxml package"
15 exit 1
16 fi
17
18 BUILDDIR="./build"
19 if [ -z "$PO_USEBUILD" ] ; then
20 WORKDIR="./integrated"
21 PODIR="./po"
22 else
23 WORKDIR="$BUILDDIR/build.po"
24 PODIR="$BUILDDIR/build.po"
25 fi
26 SOURCEDIR="$WORKDIR/en"
27 RET=0
28
29 [ -d $SOURCE ] || exit 1
30 mkdir -p $PODIR/pot
31
32 for XML in `find $SOURCEDIR -name "*.xml"` ; do
33 echo "Creating new POT file for $XML"
34 POT=$(basename $XML .xml).pot
35
36 # Let's also set a proper POT-Creation-Date
37 xml2pot $XML | \
38 sed "s/^.*POT-Creation-Date:.*$/\"POT-Creation-Date: $(date -u "+%F %R%z")\\\n\"/" \
39 >$PODIR/pot/$POT.new
40 RC=$?
41 if [ $RC -ne 0 ] ; then
42 RET=$RC
43 echo "Error: error $RC while executing xml2pot"
44 fi
45
46 if [ ! -f $PODIR/pot/$POT ] ; then
47 mv $PODIR/pot/$POT.new $PODIR/pot/$POT
48 else
49 if diff $PODIR/pot/$POT $PODIR/pot/$POT.new | grep "^[><]" | grep -qv "POT-Creation-Date: " ; then
50 mv $PODIR/pot/$POT.new $PODIR/pot/$POT
51 else
52 # Revert changes if the only thing changed is the POT-Creation-Date
53 rm $PODIR/pot/$POT.new
54 fi
55 fi
56 done
57
58 exit $RET

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5