3 # Removes mo files for incomplete translations
9 # How many percent needs to be translated
14 # Generated output file
16 OUTPUTFILE
=libraries
/language_stats.inc.php
18 if [ ! -z "$1" ] ; then
22 echo '<?php' > $OUTPUTFILE
23 echo '/* Automatically generated file, do not edit! */' >> $OUTPUTFILE
24 echo '/* Generated by scripts/remove-incomplete-mo */' >> $OUTPUTFILE
25 echo '' >> $OUTPUTFILE
26 echo '$GLOBALS["language_stats"] = array (' >> $OUTPUTFILE
30 lang
=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
31 STATS
=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1`
32 if echo $STATS |
grep -q ' translated ' ; then
33 TRANSLATED
=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/'`
37 if echo $STATS |
grep -q ' fuzzy ' ; then
38 FUZZY
=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) fuzzy.*/\2/'`
42 if echo $STATS |
grep -q ' untranslated ' ; then
43 UNTRANSLATED
=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) untranslated.*/\2/'`
47 PERCENT
=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
48 echo " '$lang' => $PERCENT," >> $OUTPUTFILE
50 if [ $PERCENT -lt $THRESHOLD ] ; then
51 echo "Removing $lang, only $PERCENT%"
52 rm -f locale
/$lang/LC_MESSAGES
/phpmyadmin.mo
60 echo ');' >> $OUTPUTFILE
61 echo '?>' >> $OUTPUTFILE