complete rewrite, now much faster and finds also unset messages
This commit is contained in:
@@ -2,15 +2,30 @@
|
|||||||
|
|
||||||
# Simple script to find unused message strings by Michal Čihař
|
# Simple script to find unused message strings by Michal Čihař
|
||||||
|
|
||||||
phpfiles=`find . -type f -a -name '*.php' -a -not -path '*/lang/*'`
|
tmp1=`mktemp`
|
||||||
|
tmp2=`mktemp`
|
||||||
|
grep -o '\<str[A-Z][a-zA-Z0-9_]*\>' lang/english-iso-8859-1.inc.php \
|
||||||
|
| grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp1
|
||||||
|
grep -ho '\<str[A-Z][a-zA-Z0-9_]*\>' `find . -type f -a -name '*.php' -a -not -path '*/lang/*'` \
|
||||||
|
| grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp2
|
||||||
|
|
||||||
grep -o 'str[A-Z][a-zA-Z_]*' lang/english-iso-8859-1.inc.php \
|
echo Please note that you need to check results of this script, it doesn\'t
|
||||||
| grep -Ev '^str(Transformation_|ShowStatus)' \
|
echo understand PHP, it only tries to find what looks like message name.
|
||||||
| while read x
|
|
||||||
do
|
echo
|
||||||
echo "Checking for $x" >&2
|
echo Used messages not present in english language file:
|
||||||
if [ `grep -r "\\<$x\\>" $phpfiles | wc -l` -eq 0 ]
|
echo '(this contains generated messages and composed message names, so these'
|
||||||
then
|
echo 'are not necessary a errors!)'
|
||||||
echo $x
|
echo
|
||||||
fi
|
|
||||||
done
|
# filter out known false positives
|
||||||
|
diff $tmp1 $tmp2 | awk '/^>/ {print $2}' | grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute)'
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Not used messages present in english language file:
|
||||||
|
echo
|
||||||
|
|
||||||
|
diff $tmp1 $tmp2 | awk '/^</ {print $2}'
|
||||||
|
|
||||||
|
|
||||||
|
rm -f $tmp1 $tmp2
|
||||||
|
Reference in New Issue
Block a user