Display warning about incomplete translations

This commit is contained in:
Michal Čihař
2011-04-05 15:28:02 +02:00
parent ef48add94c
commit 26a4a09c11
5 changed files with 37 additions and 0 deletions

View File

@@ -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

1
libraries/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
language_stats.inc.php

View File

@@ -61,6 +61,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

View File

@@ -354,6 +354,23 @@ if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_valu
trigger_error(PMA_sanitize(sprintf(__('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'), '[a@./Documentation.html#faq1_38@_blank]', '[/a]')), E_USER_WARNING);
}
/**
* 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 translation which is not complete, you are welcome to <a href="http://www.phpmyadmin.net/home_page/improve.php#translate">contribute to it</a>.', E_USER_NOTICE);
}
}
/**
* prints list item for main page
*

View File

@@ -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@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