xhtml typo
[phpmyadmin/crack.git] / lang / check_lang.sh
blobf646af28cbe3112433849fdae0a5d0029e952599
1 #!/bin/bash
2 # $Id$
3 ##
4 # Shell script to check that all language files are syncronized
5 # Catches duplicate/missing strings
7 # Robin Johnson <robbat2@users.sourceforge.net>
8 # August 9, 2002
9 ##
10 MASTER="english-iso-8859-1.inc.php3"
11 TMPDIR="tmp-check"
12 FILEPAT="*.inc.php3"
13 STRINGSTRING='^[[:space:]]*\$[[:alnum:]_]*[[:blank:]]* ='
15 rm -rf $TMPDIR
16 mkdir -p $TMPDIR
18 #Build the list of variables in each file
19 #Note the special case to strip out allow_recoding
20 echo -e "Building data"
21 for f in $FILEPAT;
24 egrep "$STRINGSTRING" $f | \
25 grep -v 'allow_recoding' | \
26 cut -d= -f1 | cut -d'$' -f2 | \
27 sort > $TMPDIR/$f
28 done;
30 #Build the diff files used for checking
31 #And if there are no differences, delete the empty files
32 echo -e "Comparing data"
33 for f in $FILEPAT;
35 diff -u $TMPDIR/$MASTER $TMPDIR/$f >$TMPDIR/$f.diff
36 if [ ! $MASTER == $f ]; then
37 if [ `wc -l $TMPDIR/$f.diff | cut -c-8|xargs` == "0" ] ;
38 then
39 rm -f $TMPDIR/$f.diff $TMPDIR/$f
40 fi;
41 fi;
42 done;
44 #build the nice difference table
45 echo -e "Differences"
46 diffstat -f 0 $TMPDIR/*.diff >$TMPDIR/diffstat 2>/dev/null
47 head -n $((`wc -l <$TMPDIR/diffstat` - 1)) $TMPDIR/diffstat > $TMPDIR/diffstat.res
48 echo -e "Dupe\tMiss\tFilename"
49 cat $TMPDIR/diffstat.res | \
50 while read filename sep change add plus sub minus edits exclaim;
51 do
52 echo -e "$add\t$sub\t$filename";
53 done;
55 echo
56 echo "Dupe = Duplicate Variables"
57 echo "Miss = Missing Variables"
58 echo "For exact problem listings, look in the $TMPDIR/ directory"
59 echo "Please remember to remove '$TMPDIR/' once you are done"