2.11.11.3 release
[phpmyadmin/sankalp_k.git] / scripts / find_unused_messages.sh
blobb0fd26eb18dc28e8c91accb38122795051eaa41d
1 #!/bin/sh
3 # Simple script to find unused message strings by Michal Čihař
5 tmp1=`mktemp`
6 tmp2=`mktemp`
7 grep -o '\<str[A-Z][a-zA-Z0-9_]*\>' lang/english-iso-8859-1.inc.php \
8 | grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp1
9 grep -ho '\<str[A-Z][a-zA-Z0-9_]*\>' `find . -type f -a -name '*.php' -a -not -path '*/lang/*'` \
10 | grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp2
12 echo Please note that you need to check results of this script, it doesn\'t
13 echo understand PHP, it only tries to find what looks like message name.
15 echo
16 echo Used messages not present in english language file:
17 echo '(this contains generated messages and composed message names, so these'
18 echo 'are not necessary a errors!)'
19 echo
21 # filter out known false positives
22 diff $tmp1 $tmp2 | awk '/^>/ {print $2}' | grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
24 echo
25 echo Not used messages present in english language file:
26 echo
28 diff $tmp1 $tmp2 | awk '/^</ {print $2}'
31 rm -f $tmp1 $tmp2