summaryrefslogtreecommitdiff
path: root/scripts/create_xml
diff options
context:
space:
mode:
authorJoey Hess <joeyh@debian.org>2005-10-07 19:51:38 +0000
committerJoey Hess <joeyh@debian.org>2005-10-07 19:51:38 +0000
commit1ea73eea5ecc6a8ed901316049259aee737ee554 (patch)
tree03a077f0b1b1548f3c806bd1c5795964fba0fb52 /scripts/create_xml
downloadinstallation-guide-1ea73eea5ecc6a8ed901316049259aee737ee554.zip
move manual to top-level directory, split out of debian-installer package
Diffstat (limited to 'scripts/create_xml')
-rwxr-xr-xscripts/create_xml57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/create_xml b/scripts/create_xml
new file mode 100755
index 000000000..2b12dc5a4
--- /dev/null
+++ b/scripts/create_xml
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# This script is used for translations using .po files.
+# It creates .xml files from the translated .po files.
+
+if [ "$1" = "--help" ] ; then
+ echo "Usage: $0 <language>"
+ exit 0
+fi
+
+language=${1:-pl}
+
+BUILDDIR="./build"
+if [ -z "$PO_USEBUILD" ] ; then
+ WORKDIR="./integrated"
+ PODIR="./po"
+else
+ WORKDIR="$BUILDDIR/build.po"
+ PODIR="$BUILDDIR/build.po"
+fi
+SOURCEDIR="$WORKDIR/en"
+# Don't overwrite XML translations committed to SVN
+if [ -d "./$language/.svn" ] ; then
+ TARGETDIR="./$language.new"
+else
+ TARGETDIR="./$language"
+fi
+RET=0
+
+[ -d "$SOURCE" -o -d "$PODIR" ] || exit 1
+
+[ -d "$TARGETDIR" ] && rm -r $TARGETDIR
+
+echo "Creating XML files for language '$language':"
+for ORIGXML in `find $SOURCEDIR -name "*.xml"` ; do
+ BASEDIR=$(dirname $ORIGXML | sed "s:$SOURCEDIR::" | sed "s:^/::")
+ BASENAME=$(basename $ORIGXML .xml)
+ PO=$PODIR/$language/$BASENAME.po
+ XML=$TARGETDIR/$BASEDIR/$BASENAME.xml
+
+ mkdir -p $TARGETDIR/$BASEDIR
+
+ if [ -f $PO ] ; then
+ echo "- creating $BASENAME.xml"
+ po2xml $ORIGXML $PO > $XML
+ RC=$?
+ if [ $RC -ne 0 ] ; then
+ RET=$RC
+ echo "Error: error $RC while executing po2xml"
+ fi
+ else
+ echo "Warning: no PO file found for '$BASENAME'; copying English original"
+ cp $ORIGXML $TARGETDIR/$BASEDIR
+ fi
+done
+
+exit $RET