Rev Author Line No. Line
250 kaklik 1 #!/bin/sh
2  
3 # Simple script to find unused message strings by Michal Čihař
4  
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
11  
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.
14  
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
20  
21 # filter out known false positives
22 diff $tmp1 $tmp2 | awk '/^>/ {print $2}' | grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
23  
24 echo
25 echo Not used messages present in english language file:
26 echo
27  
28 diff $tmp1 $tmp2 | awk '/^</ {print $2}'
29  
30  
31 rm -f $tmp1 $tmp2