[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA4-1699-g297035b

Michal Čihař nijel at users.sourceforge.net
Tue Apr 5 12:06:14 CEST 2011


The branch, master has been updated
       via  297035b8536e0a3e976d9120acd459eade2ae1cf (commit)
      from  f5eedbbaddd649741b721f8c74d8a6a5d4a621a4 (commit)


- Log -----------------------------------------------------------------
commit 297035b8536e0a3e976d9120acd459eade2ae1cf
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Apr 5 12:05:15 2011 +0200

    Do not include incomplete translations in release.
    
    Currently the threshold is set to 50%, but the discussion is still open
    on mailing list and it might change.

-----------------------------------------------------------------------

Summary of changes:
 scripts/create-release.sh    |    4 +++
 scripts/remove-incomplete-mo |   45 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100755 scripts/remove-incomplete-mo

diff --git a/scripts/create-release.sh b/scripts/create-release.sh
index 78d2c45..cd91e99 100755
--- a/scripts/create-release.sh
+++ b/scripts/create-release.sh
@@ -119,6 +119,10 @@ fi
 if [ $GETTEXT -eq 1 ] ; then
     echo "* Generating mo files"
     ./scripts/generate-mo
+    if [ -f ./scripts/remove-incomplete-mo ] ; then
+        echo "* Removing incomplete translations"
+        ./scripts/remove-incomplete-mo
+    fi
     echo "* Removing gettext source files"
     rm -rf po
 fi
diff --git a/scripts/remove-incomplete-mo b/scripts/remove-incomplete-mo
new file mode 100755
index 0000000..79ca24a
--- /dev/null
+++ b/scripts/remove-incomplete-mo
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Removes mo files for incomplete translations
+#
+
+#
+# How many percent needs to be translated
+#
+THRESHOLD=50
+
+check() {
+    lang=`echo $1 | sed 's at 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
+


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list