| 78 |
$max_versions = 5; |
$max_versions = 5; |
| 79 |
$min_versions = 1; |
$min_versions = 1; |
| 80 |
|
|
|
# $border_head = "<table width=\"95%\" align=\"center\" border=0 cellpadding=0 cellspacing=0><tr bgcolor=\"#000000\"><td>" |
|
|
# ."<table width=\"100%\" border=0 cellpadding=0 cellspacing=1><tr bgcolor=\"#ffffff\"><td>"; |
|
|
# $border_foot = "</td></tr></table></td></tr></table>"; |
|
|
|
|
| 81 |
|
|
| 82 |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
| 83 |
|
|
| 242 |
$po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0"); |
$po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0"); |
| 243 |
|
|
| 244 |
$po_total{$domain} = $po_translated{$domain}{$lang} + $po_fuzzy{$domain}{$lang} + $po_untranslated{$domain}{$lang}; |
$po_total{$domain} = $po_translated{$domain}{$lang} + $po_fuzzy{$domain}{$lang} + $po_untranslated{$domain}{$lang}; |
| 245 |
|
|
| 246 |
$po_translated{"total"}{$lang} += $po_translated{$domain}{$lang}; |
$po_translated{"total"}{$lang} += $po_translated{$domain}{$lang}; |
| 247 |
$po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang}; |
$po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang}; |
| 248 |
$po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang}; |
$po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang}; |
| 249 |
|
|
| 250 |
if ($po_total{$domain} > 0) { |
if ($po_total{$domain} > 0) { |
| 251 |
$percent_po_t{$domain}{$lang} = int ($po_translated{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
$percent_po_t{$domain}{$lang} = int ($po_translated{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
| 252 |
$percent_po_f{$domain}{$lang} = int ($po_fuzzy{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
$percent_po_f{$domain}{$lang} = int ($po_fuzzy{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
| 258 |
} |
} |
| 259 |
} |
} |
| 260 |
$po_total{"total"} = $po_translated{"total"}{$lang} + $po_fuzzy{"total"}{$lang} + $po_untranslated{"total"}{$lang}; |
$po_total{"total"} = $po_translated{"total"}{$lang} + $po_fuzzy{"total"}{$lang} + $po_untranslated{"total"}{$lang}; |
| 261 |
|
|
| 262 |
if ($po_total{'total'} > 0) { |
if ($po_total{'total'} > 0) { |
| 263 |
$percent_po_t{'total'}{$lang} = int ($po_translated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
$percent_po_t{'total'}{$lang} = int ($po_translated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
| 264 |
$percent_po_f{'total'}{$lang} = int ($po_fuzzy{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
$percent_po_f{'total'}{$lang} = int ($po_fuzzy{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
| 300 |
$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file"); |
$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file"); |
| 301 |
if (length ($msg)) { |
if (length ($msg)) { |
| 302 |
$o_body .= "<tr>"; |
$o_body .= "<tr>"; |
| 303 |
if (($file !~ /\.wml$/) |
if (($file !~ /\.wml$/) |
| 304 |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 305 |
$o_body .= sprintf "<td>%s</td>", $file; |
$o_body .= sprintf "<td>%s</td>", $file; |
| 306 |
} else { |
} else { |
| 322 |
$outdated_s{$lang} += $sizes{$file}; |
$outdated_s{$lang} += $sizes{$file}; |
| 323 |
# Up-to-date translations |
# Up-to-date translations |
| 324 |
} else { |
} else { |
| 325 |
if (($file !~ /\.wml$/) |
if (($file !~ /\.wml$/) |
| 326 |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 327 |
$t_body .= sprintf "<li>%s</li>\n", $file; |
$t_body .= sprintf "<li>%s</li>\n", $file; |
| 328 |
} else { |
} else { |
| 338 |
$u_body .= sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
$u_body .= sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
| 339 |
} else { |
} else { |
| 340 |
(my $base = $file) =~ s/\.wml$//; |
(my $base = $file) =~ s/\.wml$//; |
| 341 |
$u_body .= sprintf "<tr><td><a href=\"$opt_b/%s\">%s</a></td><td align=\"right\">%d</td><td>(%.2f ‰)</td></tr>\n", $base, $base, $sizes{$file}, int($sizes{$file}/$nsize * 100000 + .5) / 100; |
$u_body .= sprintf "<tr><td><a href=\"$opt_b/%s\">%s</a></td><td align=\"right\">%d</td><td>(%.2f ‰)</td></tr>\n", $base, $base, $sizes{$file}, int($sizes{$file}/$nsize * 100000 + 50) / 100; |
| 342 |
} |
} |
| 343 |
$untranslated{$lang}++; |
$untranslated{$lang}++; |
| 344 |
$untranslated_s{$lang} += $sizes{$file}; |
$untranslated_s{$lang} += $sizes{$file}; |
| 345 |
} |
} |
| 346 |
} |
} |
| 347 |
|
|
| 348 |
|
|
| 349 |
# this is where we discard the files that the translation directory contains |
# this is where we discard the files that the translation directory contains |
| 350 |
# but which don't exist in the English directory |
# but which don't exist in the English directory |
| 351 |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
| 353 |
$wml_s{$lang} = $translated_s{$lang}; |
$wml_s{$lang} = $translated_s{$lang}; |
| 354 |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
| 355 |
$translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang}; |
$translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang}; |
| 356 |
|
|
| 357 |
if ($nfiles > 0) { |
if ($nfiles > 0) { |
| 358 |
$percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5); |
$percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5); |
| 359 |
$percent_as{$lang} = (int ($wml_s{$lang}/$nsize * 1000 + .5))/10; |
$percent_as{$lang} = (int ($wml_s{$lang}/$nsize * 1000 + 5))/10; |
| 360 |
} else { |
} else { |
| 361 |
$percent_a{$lang} = 0; |
$percent_a{$lang} = 0; |
| 362 |
$percent_as{$lang} = 0; |
$percent_as{$lang} = 0; |
| 363 |
} |
} |
| 364 |
if ($wml{$lang} > 0) { |
if ($wml{$lang} > 0) { |
| 365 |
$percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5); |
$percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5); |
| 366 |
$percent_ts{$lang} = (int ($translated_s{$lang}/($wml_s{$lang}+1) * 1000 + .5))/10; |
$percent_ts{$lang} = (int ($translated_s{$lang}/($wml_s{$lang}+1) * 1000 + 5))/10; |
| 367 |
} else { |
} else { |
| 368 |
$percent_t{$lang} = 0; |
$percent_t{$lang} = 0; |
| 369 |
$percent_ts{$lang} = 0; |
$percent_ts{$lang} = 0; |
| 372 |
$percent_os{$lang} = 100 - $percent_ts{$lang}; |
$percent_os{$lang} = 100 - $percent_ts{$lang}; |
| 373 |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
| 374 |
$percent_us{$lang} = 100 - $percent_as{$lang}; |
$percent_us{$lang} = 100 - $percent_as{$lang}; |
| 375 |
|
|
| 376 |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
| 377 |
printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"; |
printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"; |
| 378 |
# printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang; |
# printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang; |
| 382 |
print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
| 383 |
print HTML "</head>\n<body>\n"; |
print HTML "</head>\n<body>\n"; |
| 384 |
$color = get_color ($percent_a{$lang}); |
$color = get_color ($percent_a{$lang}); |
| 385 |
|
|
| 386 |
printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color; |
printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color; |
| 387 |
printf HTML "%s: %s</h1>\n", $config{'title'}, ucfirst $lang; |
printf HTML "%s: %s</h1>\n", $config{'title'}, ucfirst $lang; |
| 388 |
printf HTML "<table style=\"background-color: %s\; width: 100%\; font-weight: bold\; margin: 0\; text-align: center\;\">\n", $color; |
printf HTML "<table summary=\"Translation Summary for $lang\" style=\"background-color: %s\; width: 100%\; font-weight: bold\; margin: 0\; text-align: center\;\">\n", $color; |
| 389 |
print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n"; |
print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n"; |
| 390 |
# printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang; |
# printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang; |
| 391 |
|
|
| 392 |
print HTML "<tr><th>Translated</th><th>Up-to-date</th><th>Outdated</th><th>Not translated</th></tr>\n<tr>"; |
print HTML "<tr><th>Translated</th><th>Up-to-date</th><th>Outdated</th><th>Not translated</th></tr>\n<tr>"; |
| 393 |
printf HTML "<td>%d files (%d%%)</td>", $wml{$lang}, $percent_a{$lang}; |
printf HTML "<td>%d files (%d%%)</td>", $wml{$lang}, $percent_a{$lang}; |
| 394 |
printf HTML "<td>%d files (%d%%)</td>", $translated{$lang}, $percent_t{$lang}; |
printf HTML "<td>%d files (%d%%)</td>", $translated{$lang}, $percent_t{$lang}; |
| 402 |
printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang}; |
printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang}; |
| 403 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 404 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 405 |
|
|
| 406 |
# Make the table of content |
# Make the table of content |
| 407 |
print HTML "<h3>Table of Contents</h3>\n"; |
print HTML "<h3>Table of Contents</h3>\n"; |
| 408 |
print HTML "<ul>\n"; |
print HTML "<ul>\n"; |
| 409 |
print HTML "<li><a href=\"./\">Back to index of languages</a>\n"; |
print HTML "<li><a href=\"./\">Back to index of languages</a></li>\n"; |
| 410 |
print HTML "<li><a href=\"../\">Working on the website</a>\n"; |
print HTML "<li><a href=\"../\">Working on the website</a></li>\n"; |
| 411 |
if ($o_body) { |
if ($o_body) { |
| 412 |
print HTML "<li><a href=\"#outdated\">Outdated translations</a>\n"; |
print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n"; |
| 413 |
} |
} |
| 414 |
if ($u_body) { |
if ($u_body) { |
| 415 |
print HTML "<li><a href=\"#untranslated\">Pages not translated</a>\n"; |
print HTML "<li><a href=\"#untranslated\">Pages not translated</a></li>\n"; |
| 416 |
} |
} |
| 417 |
if ($t_body) { |
if ($t_body) { |
| 418 |
print HTML "<li><a href=\"#uptodate\">Translations up to date</a>\n"; |
print HTML "<li><a href=\"#uptodate\">Translations up to date</a></li>\n"; |
| 419 |
} |
} |
| 420 |
if ($lang ne 'english') { |
if ($lang ne 'english') { |
| 421 |
print HTML "<li><a href=\"#gettext\">Translations of templates (gettext files)</a>\n"; |
print HTML "<li><a href=\"#gettext\">Translations of templates (gettext files)</a></li>\n"; |
| 422 |
} |
} |
| 423 |
print HTML "</ul>\n"; |
print HTML "</ul>\n"; |
| 424 |
|
|
| 425 |
# outputs the content |
# outputs the content |
| 426 |
if ($o_body) { |
if ($o_body) { |
| 427 |
print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n"; |
| 428 |
print HTML "<table border=0 cellpadding=1 cellspacing=1>\n"; |
print HTML "<table summary=\"Outdated Translations\" border=0 cellpadding=1 cellspacing=1>\n"; |
| 429 |
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
| 430 |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
| 431 |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
| 438 |
} |
} |
| 439 |
if ($u_body) { |
if ($u_body) { |
| 440 |
print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n"; |
| 441 |
print HTML "<table>\n"; |
print HTML "<table summary=\"Untranslated Pages\">\n"; |
| 442 |
print HTML $u_body; |
print HTML $u_body; |
| 443 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 444 |
} |
} |
| 452 |
if ($lang ne 'english') { |
if ($lang ne 'english') { |
| 453 |
print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n"; |
| 454 |
# print HTML $border_head; |
# print HTML $border_head; |
| 455 |
print HTML "<table width=\"100%\">\n"; |
print HTML "<table summary=\"Gettext Statistics\" width=\"100%\">\n"; |
| 456 |
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
| 457 |
foreach my $domain (sort keys %po_total) { |
foreach my $domain (sort keys %po_total) { |
| 458 |
next if $domain eq 'total'; |
next if $domain eq 'total'; |
| 459 |
print HTML "<tr>"; |
print HTML "<tr>"; |
| 460 |
|
|
| 461 |
$color_t = get_color ($percent_po_t{$domain}{$lang}); |
$color_t = get_color ($percent_po_t{$domain}{$lang}); |
| 462 |
$color_f = get_color (100 - $percent_po_f{$domain}{$lang}); |
$color_f = get_color (100 - $percent_po_f{$domain}{$lang}); |
| 463 |
$color_u = get_color (100 - $percent_po_u{$domain}{$lang}); |
$color_u = get_color (100 - $percent_po_u{$domain}{$lang}); |
| 464 |
|
|
| 465 |
print HTML "<td>$domain.$langs{$lang}.po</td>"; |
print HTML "<td>$domain.$langs{$lang}.po</td>"; |
| 466 |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang}; |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang}; |
| 467 |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang}; |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang}; |
| 480 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 481 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 482 |
} |
} |
| 483 |
|
|
| 484 |
# outputs footer |
# outputs footer |
| 485 |
print HTML "<hr><address>Compiled at $date</address>\n"; |
print HTML "<hr><address>Compiled at $date</address>\n"; |
| 486 |
print HTML "</body></html>"; |
print HTML "</body></html>"; |
| 508 |
printf HTMLI "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
printf HTMLI "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
| 509 |
|
|
| 510 |
# print HTMLI $border_head; |
# print HTMLI $border_head; |
| 511 |
print HTMLI "<table class=\"stattrans\">\n"; |
print HTMLI "<table summary=\"Translation Statistics by Page Count\" class=\"stattrans\">\n"; |
| 512 |
print HTMLI "<colgroup width=\"20%\">\n"; |
print HTMLI "<colgroup width=\"20%\">\n"; |
| 513 |
print HTMLI "<col>\n"; |
print HTMLI "<col>\n"; |
| 514 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 552 |
printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'}); |
printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'}); |
| 553 |
|
|
| 554 |
# print HTMLI $border_head; |
# print HTMLI $border_head; |
| 555 |
print HTMLI "<table class=\"stattrans\">\n"; |
print HTMLI "<table summary=\"Translation Statistics by Page Size\" class=\"stattrans\">\n"; |
| 556 |
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 557 |
print HTMLI "<colgroup span=\"1\">\n"; |
print HTMLI "<colgroup span=\"1\">\n"; |
| 558 |
print HTMLI "<col width=\"20%\">\n"; |
print HTMLI "<col width=\"20%\">\n"; |
| 597 |
print HTMLI "<h2>Translated templates (gettext files)</h2>\n"; |
print HTMLI "<h2>Translated templates (gettext files)</h2>\n"; |
| 598 |
printf HTMLI "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
printf HTMLI "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
| 599 |
# print HTMLI $border_head; |
# print HTMLI $border_head; |
| 600 |
print HTMLI "<table class=\"stattrans\">\n"; |
print HTMLI "<table summary=\"Gettext Translation Statistiks\"class=\"stattrans\">\n"; |
| 601 |
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 602 |
print HTMLI "<colgroup span=\"1\"width=\"28%\">\n"; |
print HTMLI "<colgroup span=\"1\"width=\"28%\">\n"; |
| 603 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |