Committed football_injury_report.php for bug where Warning message is displayed when...
[openemr.git] / phpmyadmin / lang / check_lang.sh
blob221e98bc650070c18796978c0a693da9dbac370a
1 #!/bin/sh
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 ##
11 MASTER="english-iso-8859-1.inc.php"
12 TMPDIR="tmp-check"
13 FILEPAT="*.inc.php"
14 STRINGMATCH='^[[:space:]]*\$[[:alnum:]_]+[[:blank:]]+='
15 IGNOREMATCH='strEncto|strKanjiEncodConvert|strXkana|allow_recoding|doc_lang'
17 if [ "`which diffstat`" = "" ] ; then
18 echo 'You need diffstat to use this!'
19 exit 1
22 rm -rf $TMPDIR
23 mkdir -p $TMPDIR
25 # Build the list of variables in each file
26 echo "Building data"
27 for f in $FILEPAT;
29 awk "/$STRINGMATCH/ && ! /$IGNOREMATCH/ { print \$1 }" $f | sort > $TMPDIR/$f
30 done
33 # Build the diff files used for checking
34 # And if there are no differences, delete the empty files
35 echo "Comparing data"
36 for f in $FILEPAT;
38 if [ ! $MASTER = $f ]; then
39 if diff -u $TMPDIR/$MASTER $TMPDIR/$f >$TMPDIR/$f.diff ; then
40 rm -f $TMPDIR/$f.diff $TMPDIR/$f
43 done
45 # Cleanup
46 rm -f $TMPDIR/$MASTER
48 # Build the nice difference table
49 echo "Differences"
50 diffstat -f 0 $TMPDIR/*.diff >$TMPDIR/diffstat 2>/dev/null
51 echo "Dupe Miss Filename"
52 head -n -1 $TMPDIR/diffstat | \
53 while read filename sep change add plus sub minus edits exclaim;
54 do
55 echo "$add $sub $filename";
56 done
58 echo
59 echo "Dupe = Duplicate Variables"
60 echo "Miss = Missing Variables"
61 echo "For exact problem listings, look in the $TMPDIR/ directory"
62 echo "Please remember to remove '$TMPDIR/' once you are done"