48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Removes mo files for incomplete translations
|
|
#
|
|
|
|
set -e
|
|
|
|
#
|
|
# How many percent needs to be translated
|
|
#
|
|
THRESHOLD=50
|
|
|
|
check() {
|
|
lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
|
|
STATS=`LANG=C msgfmt --statistics -o /dev/null $1 2>&1`
|
|
if echo $STATS | grep -q ' translated ' ; then
|
|
TRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/'`
|
|
else
|
|
TRANSLATED=0
|
|
fi
|
|
if echo $STATS | grep -q ' fuzzy ' ; then
|
|
FUZZY=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) fuzzy.*/\2/'`
|
|
else
|
|
FUZZY=0
|
|
fi
|
|
if echo $STATS | grep -q ' untranslated ' ; then
|
|
UNTRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) untranslated.*/\2/'`
|
|
else
|
|
UNTRANSLATED=0
|
|
fi
|
|
PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \)`
|
|
|
|
if [ $PERCENT -lt $THRESHOLD ] ; then
|
|
echo "Removing $lang, only $PERCENT%"
|
|
rm -f locale/$lang/LC_MESSAGES/phpmyadmin.mo
|
|
fi
|
|
}
|
|
|
|
if [ ! -z "$1" ] ; then
|
|
check po/$1.po
|
|
exit 0
|
|
fi
|
|
|
|
for x in po/*.po ; do
|
|
check $x
|
|
done
|
|
|