Little amount of fixes to make it actually produce sensible results.

This commit is contained in:
Michal Čihař
2008-11-10 11:42:54 +00:00
parent 935468a9d6
commit 20a5400712

View File

@@ -1,13 +1,17 @@
#!/bin/sh #!/bin/sh
export LANG=C
set -e
# Simple script to find unused message strings by Michal Čihař # Simple script to find unused message strings by Michal Čihař
tmp1=`mktemp` tmp1=`mktemp`
tmp2=`mktemp` tmp2=`mktemp`
grep -o '\<str[A-Z][a-zA-Z0-9_]*\>' lang/english-iso-8859-1.inc.php \ grep -o '^\$\<str[A-Z][a-zA-Z0-9_]*\>' lang/english-utf-8.inc.php \
| tr -d '$' \
| grep -Ev '^str(Transformation_|ShowStatus)' | sort -u > $tmp1 | 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 -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 -Ev '^str(Transformation_|ShowStatus|Lang|Locale|SetupForm_|SetupFormset_)' | sort -u > $tmp2
echo Please note that you need to check results of this script, it doesn\'t echo Please note that you need to check results of this script, it doesn\'t
echo understand PHP, it only tries to find what looks like message name. echo understand PHP, it only tries to find what looks like message name.
@@ -25,7 +29,7 @@ echo
echo Not used messages present in english language file: echo Not used messages present in english language file:
echo echo
diff $tmp1 $tmp2 | awk '/^</ {print $2}' diff $tmp1 $tmp2 | awk '/^</ {print $2}' | grep -Ev '(strSetup.*_(desc|name)|strSetupForm_|strSetupFormset_)'
rm -f $tmp1 $tmp2 rm -f $tmp1 $tmp2