Translation update done using Pootle.
[phpmyadmin/sankalp_k.git] / scripts / remove-incomplete-mo
blobb59d6e7224333479657b65b757cb1e7728134742
1 #!/bin/sh
3 # Removes mo files for incomplete translations
6 set -e
9 # How many percent needs to be translated
11 THRESHOLD=50
13 if [ ! -z "$1" ] ; then
14 THRESHOLD=$1
17 echo '<?php' > libraries/language_stats.inc.php
18 echo '/* Automatically generated file, do not edit! */' >> libraries/language_stats.inc.php
19 echo '/* Generated by scripts/remove-incomplete-mo */' >> libraries/language_stats.inc.php
20 echo '' >> libraries/language_stats.inc.php
21 echo '$GLOBALS["language_stats"] = array (' >> libraries/language_stats.inc.php
23 check() {
24 lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
25 STATS=`LANG=C msgfmt --statistics -o /dev/null $1 2>&1`
26 if echo $STATS | grep -q ' translated ' ; then
27 TRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/'`
28 else
29 TRANSLATED=0
31 if echo $STATS | grep -q ' fuzzy ' ; then
32 FUZZY=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) fuzzy.*/\2/'`
33 else
34 FUZZY=0
36 if echo $STATS | grep -q ' untranslated ' ; then
37 UNTRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) untranslated.*/\2/'`
38 else
39 UNTRANSLATED=0
41 PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
42 echo " '$lang' => $PERCENT," >> libraries/language_stats.inc.php
44 if [ $PERCENT -lt $THRESHOLD ] ; then
45 echo "Removing $lang, only $PERCENT%"
46 rm -f locale/$lang/LC_MESSAGES/phpmyadmin.mo
50 for x in po/*.po ; do
51 check $x
52 done
54 echo ');' >> libraries/language_stats.inc.php
55 echo '?>' >> libraries/language_stats.inc.php