remove the border removal for the Filter field; todo: improve the X reset appearance
[phpmyadmin/dkf.git] / lang / sort_lang.sh
blob42032da9b90d27cb2ec2ac543a36a362705f3b1e
1 #!/bin/sh
2 # $Id$
3 ##
4 # Shell script to make each language file neat and tidy
6 # Robin Johnson <robbat2@users.sourceforge.net>
7 # August 9, 2002
8 ##
10 specialsort()
12 in=$1
13 out=$2
15 STRINGORDER="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
17 for i in $STRINGORDER;
19 egrep '^\$str'$i $in | sort >> $out
20 echo >> $out
21 done
24 sortlang()
26 f=$1
27 targetdir=tmp-$f
28 mkdir -p $targetdir
30 TRANSLATIONSTRING='//.*translate.*$'
31 STRINGSTRING='^\$str[[:alnum:]_]+'
32 WHITESPACE='^[[:blank:]]*$'
33 CVSID='/\* \$Id$ \*/'
35 echo -n "Extracting:"
36 echo -n " head"
37 egrep -i -v $TRANSLATIONSTRING $f | \
38 egrep -v "$STRINGSTRING|$CVSID|\?>|<\?php" >> $targetdir/head
40 echo -n " cvs"
41 egrep "$CVSID" $f >>$targetdir/cvs
43 echo -n " strings"
44 egrep -i -v "$WHITESPACE|$TRANSLATIONSTRING" $f | \
45 egrep $STRINGSTRING > $targetdir/tmp-tosort
47 echo -n " pending_translations"
48 egrep -i "$STRINGSTRING.*$TRANSLATIONSTRING" $f > $targetdir/tmp-translate
49 echo
51 echo -n "Building:"
52 echo -n " strings"
53 specialsort $targetdir/tmp-tosort $targetdir/sort
55 echo -n " pending_translations"
56 if [ -s $targetdir/tmp-translate ] ; then
57 echo '// To translate:' > $targetdir/translate
58 specialsort $targetdir/tmp-translate $targetdir/translate
59 else
60 echo -n > $targetdir/translate
62 echo
64 echo "Assembling final"
65 echo "<?php" > $f
66 cat $targetdir/cvs $targetdir/head $targetdir/sort $targetdir/translate \
67 | uniq >> $f
68 echo "?>" >> $f
70 rm -rf $targetdir
73 echo "-------------------------------------------------------------------"
74 for i in "$@";
76 if [ ! -f $i ] ; then
77 echo "$i is not a file, skipping"
78 else
79 echo "Sorting $i"
80 sortlang $i
82 echo "-------------------------------------------------------------------"
83 done;