Added language scripts
This commit is contained in:
@@ -16,6 +16,10 @@ $Source$
|
|||||||
* lang/finnish: update, thanks to Visa Kopu (visa)
|
* lang/finnish: update, thanks to Visa Kopu (visa)
|
||||||
* lang/indonesion: update, thanks to Rachim Tamsjadi (tamsy)
|
* lang/indonesion: update, thanks to Rachim Tamsjadi (tamsy)
|
||||||
* lang/italian: update, thanks to Pietro Danesi (danone)
|
* lang/italian: update, thanks to Pietro Danesi (danone)
|
||||||
|
* lang/sort_lang.sh:
|
||||||
|
- New script to neaten all language files
|
||||||
|
* lang/check_lang.sh:
|
||||||
|
- New script to check language files for consistancy
|
||||||
|
|
||||||
2002-08-08 Robin Johnson <robbat2@users.sourceforge.net>
|
2002-08-08 Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
* Documentation.html:
|
* Documentation.html:
|
||||||
|
59
lang/check_lang.sh
Executable file
59
lang/check_lang.sh
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# $Id$
|
||||||
|
##
|
||||||
|
# Shell script to check that all language files are syncronized
|
||||||
|
# Catches duplicate/missing strings
|
||||||
|
#
|
||||||
|
# Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
|
# August 9, 2002
|
||||||
|
##
|
||||||
|
MASTER="english-iso-8859-1.inc.php3"
|
||||||
|
TMPDIR="tmp-check"
|
||||||
|
FILEPAT="*.inc.php3"
|
||||||
|
STRINGSTRING='^[[:space:]]*\$[[:alnum:]_]*[[:blank:]]* ='
|
||||||
|
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
|
||||||
|
#Build the list of variables in each file
|
||||||
|
#Note the special case to strip out allow_recoding
|
||||||
|
echo -e "Building data"
|
||||||
|
for f in $FILEPAT;
|
||||||
|
do
|
||||||
|
|
||||||
|
egrep "$STRINGSTRING" $f | \
|
||||||
|
grep -v 'allow_recoding' | \
|
||||||
|
cut -d= -f1 | cut -d'$' -f2 | \
|
||||||
|
sort > $TMPDIR/$f
|
||||||
|
done;
|
||||||
|
|
||||||
|
#Build the diff files used for checking
|
||||||
|
#And if there are no differences, delete the empty files
|
||||||
|
echo -e "Comparing data"
|
||||||
|
for f in $FILEPAT;
|
||||||
|
do
|
||||||
|
diff -u $TMPDIR/$MASTER $TMPDIR/$f >$TMPDIR/$f.diff
|
||||||
|
if [ ! $MASTER == $f ]; then
|
||||||
|
if [ `wc -l $TMPDIR/$f.diff | cut -c-8|xargs` == "0" ] ;
|
||||||
|
then
|
||||||
|
rm -f $TMPDIR/$f.diff $TMPDIR/$f
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
done;
|
||||||
|
|
||||||
|
#build the nice difference table
|
||||||
|
echo -e "Differences"
|
||||||
|
diffstat -f 0 $TMPDIR/*.diff >$TMPDIR/diffstat 2>/dev/null
|
||||||
|
head -n $((`wc -l <$TMPDIR/diffstat` - 1)) $TMPDIR/diffstat > $TMPDIR/diffstat.res
|
||||||
|
echo -e "Dupe\tMiss\tFilename"
|
||||||
|
cat $TMPDIR/diffstat.res | \
|
||||||
|
while read filename sep change add plus sub minus edits exclaim;
|
||||||
|
do
|
||||||
|
echo -e "$add\t$sub\t$filename";
|
||||||
|
done;
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Dupe = Duplicate Variables"
|
||||||
|
echo "Miss = Missing Variables"
|
||||||
|
echo "For exact problem listings, look in the $TMPDIR/ directory"
|
||||||
|
echo "Please remember to remove '$TMPDIR/' once you are done"
|
71
lang/sort_lang.sh
Executable file
71
lang/sort_lang.sh
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# $Id$
|
||||||
|
##
|
||||||
|
# Shell script to make each language file neat and tidy
|
||||||
|
#
|
||||||
|
# Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
|
# August 9, 2002
|
||||||
|
##
|
||||||
|
|
||||||
|
function sortlang()
|
||||||
|
{
|
||||||
|
f=$1
|
||||||
|
targetdir=tmp-$f
|
||||||
|
mkdir -p $targetdir
|
||||||
|
|
||||||
|
TRANSLATIONSTRING='//.*translate.*$'
|
||||||
|
STRINGSTRING='^[[:space:]]*\$str[[:alnum:]_]*'
|
||||||
|
WHITESPACE='^[[:blank:]]*$'
|
||||||
|
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"
|
||||||
|
|
||||||
|
echo -n "Extracting:"
|
||||||
|
echo -n " head"
|
||||||
|
egrep -i -v $TRANSLATIONSTRING $f | \
|
||||||
|
egrep -v $STRINGSTRING | \
|
||||||
|
sed 's/?>//g;s/<?php//g'| \
|
||||||
|
uniq >>$targetdir/head
|
||||||
|
|
||||||
|
echo -n " strings"
|
||||||
|
egrep -i -v $TRANSLATIONSTRING $f | \
|
||||||
|
egrep $STRINGSTRING | \
|
||||||
|
egrep -v $WHITESPACE >$targetdir/tmp-tosort
|
||||||
|
|
||||||
|
echo -n " pending_translations"
|
||||||
|
egrep -i $TRANSLATIONSTRING $f | \
|
||||||
|
uniq >$targetdir/tmp-translate
|
||||||
|
|
||||||
|
echo -e -n "\nBuilding:"
|
||||||
|
echo -n " strings"
|
||||||
|
for i in $STRINGORDER;
|
||||||
|
do
|
||||||
|
echo
|
||||||
|
egrep '^\$str'$i'[[:alpha:]]*' $targetdir/tmp-tosort | sort
|
||||||
|
done | \
|
||||||
|
uniq >>$targetdir/sort
|
||||||
|
|
||||||
|
echo -n " pending_translations"
|
||||||
|
egrep -v $STRINGSTRING $targetdir/tmp-translate | uniq > $targetdir/translate
|
||||||
|
echo >> $targetdir/translate
|
||||||
|
for i in $STRINGORDER;
|
||||||
|
do
|
||||||
|
echo
|
||||||
|
egrep '^\$str'$i'[[:alpha:]]*' $targetdir/tmp-translate | sort
|
||||||
|
done | \
|
||||||
|
uniq >>$targetdir/translate
|
||||||
|
|
||||||
|
echo -e "\nAssembling final"
|
||||||
|
f=$f$2
|
||||||
|
echo "<?php" >$f
|
||||||
|
cat $targetdir/head $targetdir/sort $targetdir/translate >>$f
|
||||||
|
echo "?>" >>$f
|
||||||
|
|
||||||
|
rm -rf $targetdir
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "-------------------------------------------------------------------"
|
||||||
|
for i in $1;
|
||||||
|
do
|
||||||
|
echo "Sorting $i"
|
||||||
|
sortlang $i
|
||||||
|
echo "-------------------------------------------------------------------"
|
||||||
|
done;
|
Reference in New Issue
Block a user