Revision f656161abbc14b1a9e7f18a02a854a863411af3b authored by Lou Burnard on 01 December 2011, 18:28:57 UTC, committed by Lou Burnard on 01 December 2011, 18:28:57 UTC
1 parent 4b761f5
Raw File
mergeLang
#!/bin/sh
#
# exit if this is not P5 source
if [ -f Source/Specs/TEI.xml ]
then
 echo merge language script
else
 echo This is not a copy of the P5 source. Exitting.
 exit 1
fi
overwrite=false
verbose=false
sourcedir=../I18N/results
while test $# -gt 0; do
  case $1 in
    --overwrite)  overwrite=true;;
    --verbose)  verbose=true;;
    --lang=*)  language=`echo $1 | sed 's/.*=//'`;;
    --sourcedir=*) sourcedir=`echo $1 | sed 's/.*=//'`;;
     *) if test "$1" = "${1#--}" ; then 
	   break
	else
	   echo "WARNING: Unrecognized option '$1' ignored"
	   echo "For usage syntax issue $0 --help"
	fi ;;
  esac
  shift
done
Source=$sourcedir-$language

X=`(cd $Source; pwd)`
for i in $X/*.xml
do
 echo found $i source file for $language
 for N in `xsltproc Utilities/getident.xsl $i | sort -u`
 do
 if [ -f Source/Specs/$N.xml ]
 then
    xsltproc --stringparam overwrite $overwrite \
	--stringparam verbose $verbose \
	--stringparam newLang $language \
	--stringparam newFile $i \
	--stringparam source $N \
    Utilities/mergeLang.xsl Source/Specs/$N.xml \
	| xmllint --format --encode utf-8 - > tmp
    mv tmp Source/Specs/$N.xml
 else
   echo WARNING: no file Source/Specs/$N.xml 
 fi
 done
done
back to top