[ Index ]
 

Code source de phpMyAdmin 2.10.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/lang/ -> check_lang.sh (source)

   1  #!/bin/sh
   2  # $Id: check_lang.sh 9393 2006-09-08 11:28:23Z lem9 $
   3  ##
   4  # Shell script to check that all language files are syncronized
   5  # Catches duplicate/missing strings
   6  #
   7  # Robin Johnson <robbat2@users.sourceforge.net>
   8  # August 9, 2002
   9  ##
  10  
  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'
  16  
  17  if [ "`which diffstat`" = "" ] ; then
  18      echo 'You need diffstat to use this!'
  19      exit 1
  20  fi
  21  
  22  rm -rf $TMPDIR
  23  mkdir -p $TMPDIR
  24  
  25  # Build the list of variables in each file
  26  echo "Building data"
  27  for f in $FILEPAT;
  28  do
  29      awk "/$STRINGMATCH/ && ! /$IGNOREMATCH/ { print \$1 }" $f | sort > $TMPDIR/$f
  30  done
  31  
  32  
  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;
  37  do
  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
  41          fi
  42      fi
  43  done
  44  
  45  # Cleanup
  46  rm -f $TMPDIR/$MASTER
  47  
  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
  57  
  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"


Généré le : Mon Nov 26 15:18:20 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics