3 # Simple script to find unused message strings by Michal Čihař
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.
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!)'
21 # filter out known false positives
22 diff $tmp1 $tmp2 |
awk '/^>/ {print $2}' |
grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
25 echo Not used messages present
in english language
file:
28 diff $tmp1 $tmp2 |
awk '/^</ {print $2}'