| 101 |
my @listfiles; |
my @listfiles; |
| 102 |
|
|
| 103 |
print "$lang " if ($config{verbose}); |
print "$lang " if ($config{verbose}); |
| 104 |
die "$0: can't find $dir!\n" if (! -d "$dir"); |
if (! -d "$dir") { |
| 105 |
|
print "$0: can't find $dir! Skipping ...\n"; |
| 106 |
|
return; |
| 107 |
|
} |
| 108 |
if ($is_english) { |
if ($is_english) { |
| 109 |
@listfiles = @{$cvs->files()}; |
@listfiles = @{$cvs->files()}; |
| 110 |
} else { |
} else { |
| 223 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 224 |
next if $lang eq 'english'; |
next if $lang eq 'english'; |
| 225 |
$po_translated{"total"}{$lang} = $po_fuzzy{"total"}{$lang} = $po_untranslated{"total"}{$lang} = 0; |
$po_translated{"total"}{$lang} = $po_fuzzy{"total"}{$lang} = $po_untranslated{"total"}{$lang} = 0; |
| 226 |
|
$percent_po_t{'total'}{$lang} = 0; |
| 227 |
|
$percent_po_f{'total'}{$lang} = 0; |
| 228 |
|
$percent_po_u{'total'}{$lang} = 100; |
| 229 |
|
if (! -d "$opt_w/$lang/po") { |
| 230 |
|
print "$0: can't find $opt_w/$lang/po! Skipping ...\n"; |
| 231 |
|
next; |
| 232 |
|
} |
| 233 |
my @status = qx,LC_ALL=C make -C $opt_w/$lang/po stats 2>&1 1>/dev/null,; |
my @status = qx,LC_ALL=C make -C $opt_w/$lang/po stats 2>&1 1>/dev/null,; |
| 234 |
foreach $line (@status) { |
foreach $line (@status) { |
| 235 |
chomp $line; |
chomp $line; |
| 251 |
} else { |
} else { |
| 252 |
$percent_po_t{$domain}{$lang} = 0; |
$percent_po_t{$domain}{$lang} = 0; |
| 253 |
$percent_po_f{$domain}{$lang} = 0; |
$percent_po_f{$domain}{$lang} = 0; |
| 254 |
$percent_po_u{$domain}{$lang} = 0; |
$percent_po_u{$domain}{$lang} = 0; # or 100 if po/ doesn't exist |
| 255 |
} |
} |
| 256 |
} |
} |
| 257 |
$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}; |
| 260 |
$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); |
| 261 |
$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); |
| 262 |
$percent_po_u{'total'}{$lang} = int ($po_untranslated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
$percent_po_u{'total'}{$lang} = int ($po_untranslated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
|
} else { |
|
|
$percent_po_t{'total'}{$lang} = 0; |
|
|
$percent_po_f{'total'}{$lang} = 0; |
|
|
$percent_po_u{'total'}{$lang} = 0; |
|
| 263 |
} |
} |
| 264 |
} |
} |
| 265 |
print "done.\n" if ($config{'verbose'}); |
print "done.\n" if ($config{'verbose'}); |
| 271 |
my $nfiles = scalar @filenames; |
my $nfiles = scalar @filenames; |
| 272 |
$nsize += $sizes{$_} foreach (@filenames); |
$nsize += $sizes{$_} foreach (@filenames); |
| 273 |
|
|
| 274 |
|
my $firstdifftype; |
| 275 |
|
my $seconddifftype; |
| 276 |
|
if ($config{'difftype'} eq 'u') { |
| 277 |
|
$firstdifftype = 'u'; |
| 278 |
|
$seconddifftype = 'h'; |
| 279 |
|
} else { |
| 280 |
|
$firstdifftype = 'h'; |
| 281 |
|
$seconddifftype = 'u'; |
| 282 |
|
} |
| 283 |
|
|
| 284 |
print "Creating files: " if ($config{'verbose'}); |
print "Creating files: " if ($config{'verbose'}); |
| 285 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 286 |
my @processed_langs = ($langs{$lang}); |
my @processed_langs = ($langs{$lang}); |
| 288 |
foreach $l (@processed_langs) { |
foreach $l (@processed_langs) { |
| 289 |
print "$l.html " if ($config{'verbose'}); |
print "$l.html " if ($config{'verbose'}); |
| 290 |
|
|
| 291 |
$t_body = $u_body = $un_body = $uu_body = $o_body = ""; |
$t_body = $u_body = $ui_body = $un_body = $uu_body = $o_body = ""; |
| 292 |
$translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0; |
$translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0; |
| 293 |
|
|
| 294 |
# get stats about files |
# get stats about files |
| 316 |
if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") { |
if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") { |
| 317 |
$o_body .= "<td></td><td></td>"; |
$o_body .= "<td></td><td></td>"; |
| 318 |
} else { |
} else { |
| 319 |
$o_body .= sprintf "<td> <a href=\"http://cvs.debian.org/webwml/$orig/%s.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\">%s -> %s</a></td>", $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $config{'difftype'}, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\">%s\ ->\ %s</a></td>", |
| 320 |
|
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 321 |
|
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\">%s\ ->\ %s</a></td>", |
| 322 |
|
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 323 |
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s?cvsroot=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"}; |
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s?cvsroot=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"}; |
| 324 |
} |
} |
| 325 |
|
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/*checkout*/webwml/%s/%s?content-type=text/plain\">[F]</a> <a href=\"http://cvs.debian.org/webwml/%s/%s?cvsroot=webwml\">[L]</a></td>", $lang, $file, $lang, $file; |
| 326 |
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
| 327 |
$o_body .= "</tr>\n"; |
$o_body .= "</tr>\n"; |
| 328 |
$outdated{$lang}++; |
$outdated{$lang}++; |
| 346 |
$u_tmp = sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
$u_tmp = sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
| 347 |
} else { |
} else { |
| 348 |
(my $base = $file) =~ s/\.wml$//; |
(my $base = $file) =~ s/\.wml$//; |
| 349 |
$u_tmp = 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}, $sizes{$file}/$nsize * 1000; |
$u_tmp = sprintf "<tr><td><a href=\"$opt_b/%s\">%s (%s)</a></td><td align=\"right\">%d</td><td>(%.2f ‰)</td></tr>\n", $base, $base, $version{"$orig/$file"}, $sizes{$file}, $sizes{$file}/$nsize * 1000; |
| 350 |
} |
} |
| 351 |
if ((($file =~ /(News|events|security|vote)\/[0-9]{4}\//) && |
if (($file =~ /international\//) && |
| 352 |
($file !~ /index.wml$/)) || |
(($file !~ /international\/index.wml$/) || |
| 353 |
($file =~ /(News\/weekly\/[0-9]{4}\/|security\/undated)/)) { |
($file !~ /international\/l10n\//))) { |
| 354 |
|
$ui_body .=$u_tmp; |
| 355 |
|
} elsif ((($file =~ /(News|events|security|vote)\/[0-9]{4}\//) && |
| 356 |
|
($file !~ /index.wml$/)) || |
| 357 |
|
($file =~ /(News\/weekly\/[0-9]{4}\/|security\/undated)/)) { |
| 358 |
$un_body .= $u_tmp; |
$un_body .= $u_tmp; |
| 359 |
} elsif (($file =~ /(consultants|users\/(com|edu|gov|org))\//) && |
} elsif (($file =~ /(consultants|users\/(com|edu|gov|org))\//) && |
| 360 |
($file !~ /index.wml$/)) { |
($file !~ /index.wml$/)) { |
| 439 |
if ($o_body) { |
if ($o_body) { |
| 440 |
print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n"; |
print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n"; |
| 441 |
} |
} |
| 442 |
if (($u_body) || ($un_body) || ($uu_body)) { |
if (($u_body) || ($ui_body) || ($un_body) || ($uu_body)) { |
| 443 |
print HTML "<li>Untranslated</li>\n"; |
print HTML "<li>Untranslated\n"; |
| 444 |
print HTML "<ul>\n"; |
print HTML "<ul>\n"; |
| 445 |
if ($u_body) { |
if ($u_body) { |
| 446 |
print HTML "<li><a href=\"#untranslated\">General pages</a></li>\n"; |
print HTML "<li><a href=\"#untranslated\">General pages</a></li>\n"; |
| 447 |
} |
} |
| 448 |
|
if ($ui_body) { |
| 449 |
|
print HTML "<li><a href=\"#untranslated-l10n\">International pages</a></li>\n"; |
| 450 |
|
} |
| 451 |
if ($un_body) { |
if ($un_body) { |
| 452 |
print HTML "<li><a href=\"#untranslated-news\">News items</a></li>\n"; |
print HTML "<li><a href=\"#untranslated-news\">News items</a></li>\n"; |
| 453 |
} |
} |
| 454 |
if ($uu_body) { |
if ($uu_body) { |
| 455 |
print HTML "<li><a href=\"#untranslated-user\">Consultant/user pages</a></li>\n"; |
print HTML "<li><a href=\"#untranslated-user\">Consultant/user pages</a></li>\n"; |
| 456 |
} |
} |
| 457 |
print HTML "</ul>\n"; |
print HTML "</ul></li>\n"; |
| 458 |
} |
} |
| 459 |
if ($t_body) { |
if ($t_body) { |
| 460 |
print HTML "<li><a href=\"#uptodate\">Translated pages (up-to-date)</a></li>\n"; |
print HTML "<li><a href=\"#uptodate\">Translated pages (up-to-date)</a></li>\n"; |
| 469 |
print HTML "<h3 id='outdated'>Outdated translations: <a href='#top'>(top)</a></h3>\n"; |
print HTML "<h3 id='outdated'>Outdated translations: <a href='#top'>(top)</a></h3>\n"; |
| 470 |
print HTML "<table summary=\"Outdated translations\" border=0 cellpadding=1 cellspacing=1>\n"; |
print HTML "<table summary=\"Outdated translations\" border=0 cellpadding=1 cellspacing=1>\n"; |
| 471 |
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>"; |
| 472 |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th><th>Colored diff</th>"; } |
| 473 |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th><th>Unified diff</th>"; } |
| 474 |
else { print HTML "<th>Diff</th>"; } |
else { print HTML "<th>Diff</th>"; } |
| 475 |
print HTML "<th>Log</th>"; |
print HTML "<th>Log</th>"; |
| 476 |
|
print HTML "<th>Translation</th>"; |
| 477 |
print HTML "<th>Maintainer</th>"; |
print HTML "<th>Maintainer</th>"; |
| 478 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 479 |
print HTML $o_body; |
print HTML $o_body; |
| 485 |
print HTML $u_body; |
print HTML $u_body; |
| 486 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 487 |
} |
} |
| 488 |
|
if ($ui_body) { |
| 489 |
|
print HTML "<h3 id='untranslated-l10n'>International pages not translated: <a href='#top'>(top)</a></h3>\n"; |
| 490 |
|
print HTML "<table summary=\"Untranslated international pages\">\n"; |
| 491 |
|
print HTML $ui_body; |
| 492 |
|
print HTML "</table>\n"; |
| 493 |
|
} |
| 494 |
if ($un_body) { |
if ($un_body) { |
| 495 |
print HTML "<h3 id='untranslated-news'>News items not translated: <a href='#top'>(top)</a></h3>\n"; |
print HTML "<h3 id='untranslated-news'>News items not translated: <a href='#top'>(top)</a></h3>\n"; |
| 496 |
print HTML "<table summary=\"Untranslated news items\">\n"; |
print HTML "<table summary=\"Untranslated news items\">\n"; |
| 539 |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
printf HTML "<td style=\"background-color: %s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 540 |
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
| 541 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 542 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 543 |
} |
} |
| 544 |
|
|
| 545 |
# outputs footer |
# outputs footer |
| 696 |
# print HTMLI $border_foot; |
# print HTMLI $border_foot; |
| 697 |
|
|
| 698 |
print HTMLI "<p><hr>\n"; |
print HTMLI "<p><hr>\n"; |
| 699 |
print HTMLI "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n"; |
print HTMLI "<p><address>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> on $date</address>\n"; |
| 700 |
print HTMLI "</body></html>\n"; |
print HTMLI "</body></html>\n"; |
| 701 |
close (HTMLI); |
close (HTMLI); |
| 702 |
|
|