Paul Vriens : transl: Add pedantic possibilities to the index page.
Alexandre Julliard
julliard at winehq.org
Tue Aug 18 10:29:46 CDT 2009
Module: tools
Branch: master
Commit: b35d5c360b3a5d13e4db6c7210d1d370c4e88d54
URL: http://source.winehq.org/git/tools.git/?a=commit;h=b35d5c360b3a5d13e4db6c7210d1d370c4e88d54
Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date: Fri Aug 14 15:12:09 2009 +0200
transl: Add pedantic possibilities to the index page.
---
transl/index.php | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/transl/index.php b/transl/index.php
index f442594..3249265 100644
--- a/transl/index.php
+++ b/transl/index.php
@@ -9,7 +9,7 @@ $transl = array();
$sum = 0;
while ($line = fgets($summary, 1024))
{
- if (!preg_match("/LANG ([0-9a-f]+:[0-9a-f]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/", $line, $m))
+ if (!preg_match("/LANG ([0-9a-f]+:[0-9a-f]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/", $line, $m))
{
die("couldn't parse line $line");
}
@@ -18,8 +18,9 @@ while ($line = fgets($summary, 1024))
continue;
$sum = $m[2];
- $transl[] = array('langid' => $m[1], 'name' => get_locale_name($m[1]), 'translated' => $m[3],
- 'missing' => $m[4], 'errors' => $m[5]);
+ $transl[] = array('langid' => $m[1], 'name' => get_locale_name($m[1]),
+ 'translated' => ($pedantic ? ($m[3] -$m[7]) : $m[3]),
+ 'missing' => $m[4], 'errors' => $m[5], 'warnings' => $m[7]);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -46,25 +47,34 @@ improve Wine translations check <?php echo $WINE_WIKI_TRANSLATIONS ?>.
</p>
<table class="index">
-<tr><th></th><th>Language</th><th>Translated</th><th>Missing</th><th>Errors</th><th> </th></tr>
+<tr><th></th><th>Language</th><th>Translated</th><th>Missing</th><th>Errors</th>
+<?php if ($pedantic) echo "<th>Warnings</th>"; ?>
+<th> </th></tr>
<?php
-function draw_bar($tr, $err, $sum)
+function draw_bar($tr, $err, $warn, $sum)
{
$tr_len = floor(($tr*300)/$sum);
$err_len = floor(($err*300)/$sum);
+ $warn_len = floor(($warn*300)/$sum);
if ($err_len == 0 && $err > 0)
{
$err_len++;
if ($tr_len > 1)
$tr_len--;
}
- $miss_len = 300 - $tr_len - $err_len;
+ if ($warn_len == 0 && $warn > 0)
+ {
+ $warn_len++;
+ if ($tr_len > 1)
+ $tr_len--;
+ }
echo '<td class="bar">';
if ($tr_len > 0)
echo "<img src=\"img/bar0.gif\" height=\"15\" width=\"$tr_len\" alt=\"translations\">";
+ if ($warn_len > 0)
+ echo "<img src=\"img/bar5.gif\" height=\"15\" width=\"$warn_len\" alt=\"warnings\">";
if ($err_len > 0)
echo "<img src=\"img/bar1.gif\" height=\"15\" width=\"$err_len\" alt=\"errors\">";
-// echo "<img src=\"img/bar6.gif\" height=\"15\" width=\"$miss_len\">";
echo "</td></tr>";
}
@@ -85,6 +95,7 @@ function nicesort($a, $b)
usort($transl, 'nicesort');
$nr = 1;
$missing_sum = 0;
+$warnings_sum = 0;
$errors_sum = 0;
$transl_sum = 0;
$serial = 0;
@@ -107,13 +118,16 @@ for ($i = 0; $i < count($transl); $i++)
}
echo "<td>".gen_lang_a($langid).$name."</a></td>";
printf("<td>%d (%.1f%%)</td>", $translated, ($translated*100)/$sum);
- echo "<td>".$missing."</td><td>".$errors."</td>\n";
- draw_bar($translated, $errors, $sum);
+ echo "<td>".$missing."</td><td>".$errors."</td>";
+ if ($pedantic) echo "<td>".$warnings."</td>";
+ echo "\n";
+ draw_bar($translated, $errors, $pedantic ? $warnings : 0, $sum);
$nr++;
$transl_sum += $translated;
$missing_sum += $missing;
$errors_sum += $errors;
+ $warnings_sum += $warnings;
$serial--;
}
?>
@@ -121,7 +135,8 @@ for ($i = 0; $i < count($transl); $i++)
<td><?php printf("%d (%.1f%%)", $transl_sum, ($transl_sum*100)/(($nr-1)*$sum)) ?></td>
<td><?php echo $missing_sum ?></td>
<td><?php echo $errors_sum ?></td>
-<?php draw_bar($transl_sum, $errors_sum, ($nr-1)*$sum) ?>
+<?php if ($pedantic) echo "<td>$warnings_sum</td>"; ?>
+<?php draw_bar($transl_sum, $errors_sum, $pedantic ? $warnings_sum : 0, ($nr-1)*$sum) ?>
</table>
</div>
</div>
More information about the wine-cvs
mailing list