6 # Simple script to find unused message strings by Michal Čihař
10 grep -o '^\$\<str[A-Z][a-zA-Z0-9_]*\>' lang
/english-utf-8.inc.php \
12 |
grep -Ev '^str(Transformation_|ShowStatus)' |
sort -u > $tmp1
13 grep -ho '\<str[A-Z][a-zA-Z0-9_]*\>' `find . -type f -a -name '*.php' -a -not -path '*/lang/*'` \
14 |
grep -Ev '^str(Transformation_|ShowStatus|Lang|Locale|SetupForm_|SetupFormset_)' |
sort -u > $tmp2
16 echo Please note that you need to check results of this
script, it doesn
\'t
17 echo understand PHP
, it only tries to
find what looks like message name.
20 echo Used messages not present
in english language
file:
21 echo '(this contains generated messages and composed message names, so these'
22 echo 'are not necessary a errors!)'
25 # filter out known false positives
26 diff $tmp1 $tmp2 |
awk '/^>/ {print $2}' |
grep -Ev '(strEncto|strXkana|strDBLink|strPrivDesc|strPrivDescProcess|strTableListOptions|strMissingParameter|strAttribute|strDoSelectAll)'
29 echo Not used messages present
in english language
file:
32 diff $tmp1 $tmp2 |
awk '/^</ {print $2}' |
grep -Ev '(strSetup.*_(desc|name)|strSetupForm_|strSetupFormset_)'