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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
function check_xml()
{
if test -f $trans_doc; then
case $trans_doc in
*/api/index.docbook) ;;
*/index.docbook)
if ! meinproc --check --stdout $trans_doc > /dev/null; then
meinproc --check --stdout $trans_doc
if test "$delete" = 1; then
echo "REMOVING $trans_doc"
echo "REMOVING $trans_doc">>update_xml.log
rm -f $trans_doc
else
echo "Failed on $trans_doc. Exiting."
exit 1
fi
fi
;;
*) ;;
esac
fi
}
LANG=C
LC_ALL=C
LC_MESSAGES=C
modules="kdelibs kdebase kdegames kdegraphics kdeutils kdenetwork kdemultimedia kdeadmin kdesdk kdetoys koffice kdenonbeta kdepim kdeaddons kdeedu kdeextragear-1 kdevelop quanta"
if test $# = 0 || test $1 = "--help" ; then
echo "update_xml [--nodelete] <lang_subdir> [selection]"
exit
fi
delete=1
if test $1 = "--nodelete"; then
delete=0
shift
fi
subdir=$1
selection=$2
if test -z "$selection"; then
selection=*
fi
for m in $modules; do
if test -d ../$m/doc; then
files=`( cd .. && find $m/doc -name "*.docbook")`
for i in $files; do
case $i in
*_original.docbook)
continue
;;
*$selection*)
;;
*)
continue;;
esac
j=`echo $i | sed -e "s#$m/doc/##" | sed -e 's#.docbook$##' | sed -e 's#/index$##' | sed -e "s#/#_#g"`
translations=`ls -1 $subdir/messages/docs/$m/$j.po 2>/dev/null`
for t in $translations; do
bd=`dirname $t`
p=`echo $i | sed -e "s#$m/doc/##"`
trans_doc="$bd/../../../docs/$m/$p"
dir=`dirname $trans_doc`
result=`msgfmt -o /dev/null --statistics $t 2>&1`
ret=$?
if test $delete = 0 && test ! "$ret" = 0; then
echo "ERROR: msgfmt $t failed. Exiting."
exit 1
fi
if test ! "$ret" = "0" || echo $result | grep -q untranslated; then
echo "$t: $result"
continue
fi
if echo $result | grep -q fuzzy; then
echo "$t: $result"
continue
fi
echo po2xml ../$i $t
po2xml ../$i $t > temp.xml
language=`cat $bd/../language `
if test -n "$language"; then
sed -e "s,<!ENTITY % English,<!ENTITY % $language," temp.xml > temp.xml.new
mv temp.xml.new temp.xml
fi
lang=$subdir
if ! test -d $dir/CVS; then
mkdir -p $dir
mv temp.xml $trans_doc
echo Makefile > $dir/.cvsignore
echo Makefile.in >> $dir/.cvsignore
echo > $dir/Makefile.am
echo "KDE_LANG=$lang" >> $dir/Makefile.am
echo "KDE_DOCS=AUTO" >> $dir/Makefile.am
idir=`(cd $dir && pwd | sed -e 's#.*/\([^/]*\)$#\1#')`
(cd $dir/.. && cvs add $idir)
(cd $dir && cvs add Makefile.am .cvsignore index.docbook)
else
if ! cmp -s temp.xml $trans_doc; then
:
mv temp.xml $trans_doc
else
rm temp.xml
fi
fi
check_xml;
done
done
fi
done
|