[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA4-1778-g53cf98d

Michal Čihař nijel at users.sourceforge.net
Wed Apr 6 09:49:58 CEST 2011


The branch, master has been updated
       via  53cf98d34c3b60c3fde6c6d13743b7b59d2ca4b9 (commit)
       via  26a4a09c111fec9edf0ebb680627720a1ce1cedd (commit)
      from  ef48add94c60abdc056303aed9f7eab3cb347f93 (commit)


- Log -----------------------------------------------------------------
commit 53cf98d34c3b60c3fde6c6d13743b7b59d2ca4b9
Author: Rouslan Placella <rouslan at placella.com>
Date:   Wed Apr 6 09:49:27 2011 +0200

    Better message for incomplete translation.

commit 26a4a09c111fec9edf0ebb680627720a1ce1cedd
Author: Michal Čihař <mcihar at novell.com>
Date:   Tue Apr 5 15:28:02 2011 +0200

    Display warning about incomplete translations

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

Summary of changes:
 Documentation.html           |    3 +++
 libraries/.gitignore         |    1 +
 libraries/config.default.php |    7 +++++++
 main.php                     |   17 +++++++++++++++++
 scripts/remove-incomplete-mo |    9 +++++++++
 5 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 libraries/.gitignore

diff --git a/Documentation.html b/Documentation.html
index af3c44b..baa3d1e 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -624,6 +624,9 @@ since this link provides funding for phpMyAdmin.
     You can set this parameter to <tt>TRUE</tt> to stop this message 
     from appearing.</dd>
 
+    <dd id="cfg_TranslationWarningThreshold">$cfg['TranslationWarningThreshold'] integer</dt>
+    <dd>Show warning about incomplete translations on certain threshold.</dd>
+
     <dt id="cfg_AllowThirdPartyFraming">$cfg['AllowThirdPartyFraming'] boolean</dt>
     <dd>Setting this to <tt>true</tt> allows a page located on a different
     domain to call phpMyAdmin inside a frame, and is a potential security
diff --git a/libraries/.gitignore b/libraries/.gitignore
new file mode 100644
index 0000000..ea4a1fd
--- /dev/null
+++ b/libraries/.gitignore
@@ -0,0 +1 @@
+language_stats.inc.php
diff --git a/libraries/config.default.php b/libraries/config.default.php
index d47b705..4ca31e7 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -62,6 +62,13 @@ $cfg['SuhosinDisableWarning'] = false;
 $cfg['McryptDisableWarning'] = false;
 
 /**
+ * Show warning about incomplete translations on certain threshold.
+ *
+ * @global boolean $cfg['TranslationWarningThreshold']
+ */
+$cfg['TranslationWarningThreshold'] = 80;
+
+/**
  * Allows phpMyAdmin to be included from a document located on
  * another domain; setting this to true is a potential security hole
  *
diff --git a/main.php b/main.php
index 431f65b..c29a508 100644
--- a/main.php
+++ b/main.php
@@ -355,6 +355,23 @@ if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_valu
     }
 
 /**
+ * Warning about incomplete translations.
+ *
+ * The data file is created while creating release by ./scripts/remove-incomplete-mo
+ */
+if (file_exists('./libraries/language_stats.inc.php')) {
+    include('./libraries/language_stats.inc.php');
+    /*
+     * This message is intentionally not translated, because we're
+     * handling incomplete translations here and focus on english
+     * speaking users.
+     */
+    if (isset($GLOBALS['language_stats'][$lang]) && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']) {
+        trigger_error('You are using an incomplete translation, please help to make it better by <a href="http://www.phpmyadmin.net/home_page/improve.php#translate">contributing</a>.', E_USER_NOTICE);
+    }
+}
+
+/**
  * prints list item for main page
  *
  * @param   string  $name   displayed text
diff --git a/scripts/remove-incomplete-mo b/scripts/remove-incomplete-mo
index 65b5ad4..a9ff4eb 100755
--- a/scripts/remove-incomplete-mo
+++ b/scripts/remove-incomplete-mo
@@ -14,6 +14,12 @@ if [ ! -z "$1" ] ; then
     THRESHOLD=$1
 fi
 
+echo '<?php' > libraries/language_stats.inc.php
+echo '/* Automatically generated file, do not edit! */' >> libraries/language_stats.inc.php
+echo '/* Generated bt scripts/remove-incomplete-mo */' >> libraries/language_stats.inc.php
+echo '' >> libraries/language_stats.inc.php
+echo '$GLOBALS["language_stats"] = array (' >> libraries/language_stats.inc.php
+
 check() {
     lang=`echo $1 | sed 's at po/\(.*\)\.po@\1@'`
     STATS=`LANG=C  msgfmt --statistics -o /dev/null $1 2>&1`
@@ -33,6 +39,7 @@ check() {
         UNTRANSLATED=0
     fi
     PERCENT=`expr 100 \* $TRANSLATED / \( $TRANSLATED + $FUZZY + $UNTRANSLATED \) || true`
+    echo "    '$lang' => $PERCENT," >> libraries/language_stats.inc.php
 
     if [ $PERCENT -lt $THRESHOLD ] ; then
         echo "Removing $lang, only $PERCENT%"
@@ -44,3 +51,5 @@ for x in po/*.po  ; do
     check $x
 done
 
+echo ');' >> libraries/language_stats.inc.php
+echo '?>' >> libraries/language_stats.inc.php


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list