Fix for 3299241. Updated style for "disabled" topnav buttons.
[phpmyadmin/ammaryasirr.git] / scripts / remove-incomplete-mo
blob02069f9281807d0349a4492f01513103be68815e
1 #!/bin/sh
3 # Removes mo files for incomplete translations
6 set -e
9 # How many percent needs to be translated
11 THRESHOLD=50
14 # Generated output file
16 TMPOUTPUTFILE=libraries/language_stats.inc.php.tmp
17 OUTPUTFILE=libraries/language_stats.inc.php
19 if [ ! -z "$1" ] ; then
20 THRESHOLD=$1
23 echo '<?php' > $TMPOUTPUTFILE
24 echo '/* Automatically generated file, do not edit! */' >> $TMPOUTPUTFILE
25 echo '/* Generated by scripts/remove-incomplete-mo */' >> $TMPOUTPUTFILE
26 echo '' >> $TMPOUTPUTFILE
27 echo '$GLOBALS["language_stats"] = array (' >> $TMPOUTPUTFILE
29 check() {
30 TMPOUTPUTFILE=$2
31 lang=`echo $1 | sed 's@po/\(.*\)\.po@\1@'`
32 STATS=`LC_ALL=C msgfmt --statistics -o /dev/null $1 2>&1`
33 if echo $STATS | grep -q ' translated ' ; then
34 TRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/'`
35 else
36 TRANSLATED=0
38 if echo $STATS | grep -q ' fuzzy ' ; then
39 FUZZY=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) fuzzy.*/\2/'`
40 else
41 FUZZY=0
43 if echo $STATS | grep -q ' untranslated ' ; then
44 UNTRANSLATED=`echo $STATS | sed 's/\(^\|.* \)\([0-9]*\) untranslated.*/\2/'`
45 else
46 UNTRANSLATED=0
48 PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
49 echo " '$lang' => $PERCENT," >> $TMPOUTPUTFILE
51 if [ $PERCENT -lt $THRESHOLD ] ; then
52 echo "Removing $lang, only $PERCENT%"
53 rm -f locale/$lang/LC_MESSAGES/phpmyadmin.mo
57 for x in po/*.po ; do
58 check $x $TMPOUTPUTFILE
59 done
61 echo ');' >> $TMPOUTPUTFILE
62 echo '?>' >> $TMPOUTPUTFILE
64 mv $TMPOUTPUTFILE $OUTPUTFILE