Use a variable for the generated file
This commit is contained in:
@@ -10,17 +10,23 @@ set -e
|
|||||||
#
|
#
|
||||||
THRESHOLD=50
|
THRESHOLD=50
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generated output file
|
||||||
|
#
|
||||||
|
OUTPUTFILE=libraries/language_stats.inc.php
|
||||||
|
|
||||||
if [ ! -z "$1" ] ; then
|
if [ ! -z "$1" ] ; then
|
||||||
THRESHOLD=$1
|
THRESHOLD=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '<?php' > libraries/language_stats.inc.php
|
echo '<?php' > $OUTPUTFILE
|
||||||
echo '/* Automatically generated file, do not edit! */' >> libraries/language_stats.inc.php
|
echo '/* Automatically generated file, do not edit! */' >> $OUTPUTFILE
|
||||||
echo '/* Generated by scripts/remove-incomplete-mo */' >> libraries/language_stats.inc.php
|
echo '/* Generated by scripts/remove-incomplete-mo */' >> $OUTPUTFILE
|
||||||
echo '' >> libraries/language_stats.inc.php
|
echo '' >> $OUTPUTFILE
|
||||||
echo '$GLOBALS["language_stats"] = array (' >> libraries/language_stats.inc.php
|
echo '$GLOBALS["language_stats"] = array (' >> $OUTPUTFILE
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
|
OUTPUTFILE=$2
|
||||||
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
|
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
|
||||||
STATS=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1`
|
STATS=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1`
|
||||||
if echo $STATS | grep -q ' translated ' ; then
|
if echo $STATS | grep -q ' translated ' ; then
|
||||||
@@ -39,7 +45,7 @@ check() {
|
|||||||
UNTRANSLATED=0
|
UNTRANSLATED=0
|
||||||
fi
|
fi
|
||||||
PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
|
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
|
if [ $PERCENT -lt $THRESHOLD ] ; then
|
||||||
echo "Removing $lang, only $PERCENT%"
|
echo "Removing $lang, only $PERCENT%"
|
||||||
@@ -48,8 +54,8 @@ check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for x in po/*.po ; do
|
for x in po/*.po ; do
|
||||||
check $x
|
check $x $OUTPUTFILE
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ');' >> libraries/language_stats.inc.php
|
echo ');' >> $OUTPUTFILE
|
||||||
echo '?>' >> libraries/language_stats.inc.php
|
echo '?>' >> $OUTPUTFILE
|
||||||
|
Reference in New Issue
Block a user