3 # Calculate po translation statistics of all po files inside $CATALOGS_DIR
\r
4 # and write the result to standard output
\r
6 # Copyright (C) 2004-2008 the TortoiseSVN team
\r
7 # This file is distributed under the same license as TortoiseSVN
\r
10 # $Date: 2008-06-23 17:52:54 +0800 (Mon, 23 Jun 2008) $
\r
13 # Author: Lübbe Onken 2004-2008
\r
16 HOME_DIR=/var/svnwc/l10n
\r
20 SVNVERSION=svnversion
\r
21 CATALOGS_DIR="$HOME_DIR/$1/doc"
\r
22 TEMP_DIR="$CATALOGS_DIR/tmp"
\r
24 WCREV=`$SVNVERSION $CATALOGS_DIR | sed -e 's/[MS]//g'`
\r
33 x=`$MSGFMT --verbose -o /dev/null ${CATALOGS_DIR}/${APP}.pot 2>&1 | grep 'translated messages' | \
\r
34 sed -e 's/[,\.]//g' \
\r
35 -e 's/\([0-9]\+\) translated messages\?/TR=\1/' \
\r
36 -e 's/\([0-9]\+\) untranslated messages\?/TO=\1/'`
\r
40 echo '$'${APP}'= array('
\r
42 for i in ${CATALOGS_DIR}/${APP}*.po ; do
\r
43 ER=0 AK=0 TR=0 FZ=0 UT=0
\r
44 catname=`basename $i .po`
\r
45 country=`basename $i .po | sed -e 's/'${APP}'_//'`
\r
46 tempfile="$TEMP_DIR/$catname.po"
\r
47 filedate=`stat -c "%y" ${CATALOGS_DIR}/$catname.po`
\r
49 x=`cat ${CATALOGS_DIR}/$catname.po | grep 'PO-Revision-Date:' | \
\r
50 sed -e 's/"PO-Revision-Date: //g' \
\r
51 -e 's/[0-9]\{2\}:[0-9]\{2\}.*//g' \
\r
52 -e 's/\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\)/PRD=\1/'`
\r
56 $MSGMERGE --no-wrap --quiet --no-fuzzy-matching -s $i ${CATALOGS_DIR}/${APP}.pot -o $tempfile 2>/dev/null
\r
58 x=`$MSGFMT -c -o /dev/null $tempfile 2>&1 | grep 'fatal error' | \
\r
59 sed -e 's/[^0-9]//g' \
\r
60 -e 's/\([0-9]\+\)\?/ER=\1/'`
\r
63 if test $ER -eq 0 ; then
\r
65 x=`$MSGFMT --verbose -o /dev/null $tempfile 2>&1 | grep 'translated messages' | \
\r
66 sed -e 's/[,\.]//g' \
\r
67 -e 's/\([0-9]\+\) translated messages\?/TR=\1/' \
\r
68 -e 's/\([0-9]\+\) fuzzy translations\?/FZ=\1/' \
\r
69 -e 's/\([0-9]\+\) untranslated messages\?/UT=\1/'`
\r
73 echo "\"$country\" => array($ER, $TO, $TR, $FZ, $UT, 0, \"$catname\", \"$PRD\"),"
\r
76 # Separate line for the .pot file
\r
77 filedate=`stat -c "%Y" ${CATALOGS_DIR}/${APP}.pot`
\r
78 echo "\"zzz\" => array(-1, $TO, 0, 0, $TO, 0, \"${APP}.pot\", \"$filedate\")"
\r
85 x=`$MSGFMT --verbose -o /dev/null ${CATALOGS_DIR}/${APP}.pot 2>&1 | grep 'translated messages' | \
\r
86 sed -e 's/[,\.]//g' \
\r
87 -e 's/\([0-9]\+\) translated messages\?/TR=\1/' \
\r
88 -e 's/\([0-9]\+\) untranslated messages\?/TO=\1/'`
\r
92 echo '$'${APP}'= array('
\r
94 for i in ${CATALOGS_DIR}/${APP}*.po ; do
\r
95 ER=0 AK=0 TR=0 FZ=0 UT=0
\r
96 catname=`basename $i .po`
\r
97 country=`basename $i .po | sed -e 's/'${APP}'_//'`
\r
98 tempfile="$TEMP_DIR/$catname.po"
\r
99 filedate=`stat -c "%y" ${CATALOGS_DIR}/$catname.po`
\r
101 x=`cat ${CATALOGS_DIR}/$catname.po | grep 'PO-Revision-Date:' | \
\r
102 sed -e 's/"PO-Revision-Date: //g' \
\r
103 -e 's/[0-9]\{2\}:[0-9]\{2\}.*//g' \
\r
104 -e 's/\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\)/PRD=\1/'`
\r
108 $MSGMERGE --no-wrap --quiet --no-fuzzy-matching -s $i ${CATALOGS_DIR}/${APP}.pot -o $tempfile 2>/dev/null
\r
110 x=`$MSGFMT -c -o /dev/null $tempfile 2>&1 | grep 'fatal error' | \
\r
111 sed -e 's/[^0-9]//g' \
\r
112 -e 's/\([0-9]\+\)\?/ER=\1/'`
\r
115 if test $ER -eq 0 ; then
\r
117 x=`$MSGFMT --verbose -o /dev/null $tempfile 2>&1 | grep 'translated messages' | \
\r
118 sed -e 's/[,\.]//g' \
\r
119 -e 's/\([0-9]\+\) translated messages\?/TR=\1/' \
\r
120 -e 's/\([0-9]\+\) fuzzy translations\?/FZ=\1/' \
\r
121 -e 's/\([0-9]\+\) untranslated messages\?/UT=\1/'`
\r
125 echo "\"$country\" => array($ER, $TO, $TR, $FZ, $UT, 0, \"$catname\", \"$PRD\"),"
\r
126 # echo "\"$country\" => array($ER, $TO, $TR, $FZ, $UT, 0, \"$catname\", \"$filedate\"),"
\r
128 # Separate line for the .pot file
\r
129 filedate=`stat -c "%Y" ${CATALOGS_DIR}/${APP}.pot`
\r
130 echo "\"zzz\" => array(-1, $TO, 0, 0, $TO, 0, \"${APP}.pot\", \"$filedate\")"
\r