diff --git a/scripts/remove-incomplete-mo b/scripts/remove-incomplete-mo index dfddc371c..83d14ea7a 100755 --- a/scripts/remove-incomplete-mo +++ b/scripts/remove-incomplete-mo @@ -10,17 +10,23 @@ set -e # THRESHOLD=50 +# +# Generated output file +# +OUTPUTFILE=libraries/language_stats.inc.php + if [ ! -z "$1" ] ; then THRESHOLD=$1 fi -echo ' libraries/language_stats.inc.php -echo '/* Automatically generated file, do not edit! */' >> libraries/language_stats.inc.php -echo '/* Generated by scripts/remove-incomplete-mo */' >> libraries/language_stats.inc.php -echo '' >> libraries/language_stats.inc.php -echo '$GLOBALS["language_stats"] = array (' >> libraries/language_stats.inc.php +echo ' $OUTPUTFILE +echo '/* Automatically generated file, do not edit! */' >> $OUTPUTFILE +echo '/* Generated by scripts/remove-incomplete-mo */' >> $OUTPUTFILE +echo '' >> $OUTPUTFILE +echo '$GLOBALS["language_stats"] = array (' >> $OUTPUTFILE check() { + OUTPUTFILE=$2 lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'` STATS=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1` if echo $STATS | grep -q ' translated ' ; then @@ -39,7 +45,7 @@ check() { UNTRANSLATED=0 fi PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true` - echo " '$lang' => $PERCENT," >> libraries/language_stats.inc.php + echo " '$lang' => $PERCENT," >> $OUTPUTFILE if [ $PERCENT -lt $THRESHOLD ] ; then echo "Removing $lang, only $PERCENT%" @@ -48,8 +54,8 @@ check() { } for x in po/*.po ; do - check $x + check $x $OUTPUTFILE done -echo ');' >> libraries/language_stats.inc.php -echo '?>' >> libraries/language_stats.inc.php +echo ');' >> $OUTPUTFILE +echo '?>' >> $OUTPUTFILE