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

Contents of /trunk/manual/scripts/create_xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32343 - (show annotations) (download)
Mon Nov 21 18:10:38 2005 UTC (7 years, 6 months ago) by fjp
File size: 1702 byte(s)
Make sure po files are utf-8 encoded before running po2xml
1 #!/bin/sh
2
3 # This script is used for translations using .po files.
4 # It creates .xml files from the translated .po files.
5
6 if [ "$1" = "--help" ] ; then
7 echo "Usage: $0 <language>"
8 exit 0
9 fi
10
11 language=${1:-pl}
12
13 BUILDDIR="./build"
14 if [ -z "$PO_USEBUILD" ] ; then
15 WORKDIR="./integrated"
16 PODIR="./po"
17 else
18 WORKDIR="$BUILDDIR/build.po"
19 PODIR="$BUILDDIR/build.po"
20 fi
21 SOURCEDIR="$WORKDIR/en"
22 # Don't overwrite XML translations committed to SVN
23 if [ -d "./$language/.svn" ] ; then
24 TARGETDIR="./$language.new"
25 else
26 TARGETDIR="./$language"
27 fi
28 RET=0
29
30 [ -d "$SOURCE" -o -d "$PODIR" ] || exit 1
31
32 [ -d "$TARGETDIR" ] && rm -r $TARGETDIR
33
34 echo "Creating XML files for language '$language':"
35 for ORIGXML in `find $SOURCEDIR -name "*.xml"` ; do
36 BASEDIR=$(dirname $ORIGXML | sed "s:$SOURCEDIR::" | sed "s:^/::")
37 BASENAME=$(basename $ORIGXML .xml)
38 PO=$PODIR/$language/$BASENAME.po
39 XML=$TARGETDIR/$BASEDIR/$BASENAME.xml
40
41 mkdir -p $TARGETDIR/$BASEDIR
42
43 if [ -f $PO ] ; then
44 echo "- creating $BASENAME.xml"
45 # Make sure po file is UTF8 encoded; po2xml does no conversion
46 msgconv -t utf-8 $PO >/tmp/tmp.po.$$
47 RC=$?
48 if [ $RC -ne 0 ] ; then
49 RET=$RC
50 echo "Error: error $RC while executing msgconv"
51 continue
52 fi
53 po2xml $ORIGXML /tmp/tmp.po.$$ > $XML
54 RC=$?
55 if [ $RC -ne 0 ] ; then
56 RET=$RC
57 echo "Error: error $RC while executing po2xml"
58 continue
59 fi
60 else
61 echo "Warning: no PO file found for '$BASENAME'; copying English original"
62 cp $ORIGXML $TARGETDIR/$BASEDIR
63 fi
64 done
65
66 rm -f /tmp/tmp.po.$$
67 exit $RET

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5