| 27 |
use Webwml::TransCheck; |
use Webwml::TransCheck; |
| 28 |
use Webwml::TransIgnore; |
use Webwml::TransIgnore; |
| 29 |
|
|
| 30 |
|
BEGIN { |
| 31 |
|
$udd_available = 0; |
| 32 |
|
eval { |
| 33 |
|
require JSON; |
| 34 |
|
require LWP::Simple; |
| 35 |
|
LWP::Simple->import; |
| 36 |
|
$udd_available = 1; |
| 37 |
|
}; if ($@) { |
| 38 |
|
warn "One or more modules required for DDE support failed to load: $@\n"; |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
|
| 43 |
$| = 1; |
$| = 1; |
| 44 |
|
|
| 45 |
$opt_h = "/org/www.debian.org/www/devel/website/stats"; |
$opt_h = "/srv/www.debian.org/webwml/english/devel/website/stats"; |
| 46 |
$opt_w = "/org/www.debian.org/webwml"; |
$opt_w = "/srv/www.debian.org/webwml"; |
| 47 |
$opt_p = "*.(wml|src)"; |
$opt_p = "*.(wml|src)"; |
| 48 |
$opt_t = "Debian web site translation statistics"; |
$opt_t = '<stats_title>'; |
| 49 |
$opt_v = 0; |
$opt_v = 0; |
| 50 |
$opt_d = "u"; |
$opt_d = "u"; |
| 51 |
$opt_l = undef; |
$opt_l = undef; |
| 52 |
$opt_b = ""; # Base URL, if not debian.org |
$opt_b = ""; # Base URL, if not debian.org |
| 53 |
getopts('h:w:b:p:t:vd:l:') || die; |
# URL of JSON data or path to plaintext file with lines: "1299999 /doc/index\n" |
| 54 |
|
$opt_f = "http://dde.debian.net/dde/q/static/porridge/stats?t=json"; |
| 55 |
|
getopts('h:w:b:p:t:vd:l:f:') || die; |
| 56 |
# Replace filename globbing by Perl regexps |
# Replace filename globbing by Perl regexps |
| 57 |
$opt_p =~ s/\./\\./g; |
$opt_p =~ s/\./\\./g; |
| 58 |
$opt_p =~ s/\?/./g; |
$opt_p =~ s/\?/./g; |
| 65 |
'title' => $opt_t, |
'title' => $opt_t, |
| 66 |
'verbose' => $opt_v, |
'verbose' => $opt_v, |
| 67 |
'difftype'=> $opt_d, |
'difftype'=> $opt_d, |
| 68 |
|
'hit_file'=> $opt_f, |
| 69 |
); |
); |
| 70 |
|
|
| 71 |
my $l = Webwml::Langs->new($opt_w); |
my $l = Webwml::Langs->new($opt_w); |
| 103 |
my %files; |
my %files; |
| 104 |
my %sizes; |
my %sizes; |
| 105 |
|
|
|
sub format3($) { |
|
|
$_ = sprintf("%d", shift); |
|
|
# $_ = " $_" if length($_) < 2; |
|
|
# $_ = " $_" if length($_) < 3; |
|
|
# $_; |
|
|
} |
|
|
sub format5($) { |
|
|
$_ = sprintf("%d", shift); |
|
|
# $_ = sprintf("%.1f", shift); |
|
|
# $_ = " $_" if length($_) < 4; |
|
|
# $_ = " $_" if length($_) < 5; |
|
|
# $_; |
|
|
} |
|
| 106 |
# Count wml files in given directory |
# Count wml files in given directory |
| 107 |
# |
# |
| 108 |
sub getwmlfiles |
sub getwmlfiles |
| 117 |
my @listfiles; |
my @listfiles; |
| 118 |
|
|
| 119 |
print "$lang " if ($config{verbose}); |
print "$lang " if ($config{verbose}); |
| 120 |
die "$0: can't find $dir!\n" if (! -d "$dir"); |
if (! -d "$dir") { |
| 121 |
|
print "$0: can't find $dir! Skipping ...\n"; |
| 122 |
|
return; |
| 123 |
|
} |
| 124 |
if ($is_english) { |
if ($is_english) { |
| 125 |
@listfiles = @{$cvs->files()}; |
@listfiles = @{$cvs->files()}; |
| 126 |
} else { |
} else { |
| 200 |
# From translation-check.wml |
# From translation-check.wml |
| 201 |
|
|
| 202 |
if ( $major_number != $major_translated_number ) { |
if ( $major_number != $major_translated_number ) { |
| 203 |
return "This translation is too out of date"; |
return '<gettext domain="stats">This translation is too out of date</gettext>'; |
| 204 |
} elsif ( $last_number - $last_translated_number < 0 ) { |
} elsif ( $last_number - $last_translated_number < 0 ) { |
| 205 |
return "Wrong translation version"; |
return '<gettext domain="stats">Wrong translation version</gettext>'; |
| 206 |
} elsif ( $last_number - $last_translated_number >= $max_versions ) { |
} elsif ( $last_number - $last_translated_number >= $max_versions ) { |
| 207 |
return "This translation is too out of date"; |
return '<gettext domain="stats">This translation is too out of date</gettext>'; |
| 208 |
} elsif ( $last_number - $last_translated_number >= $min_versions ) { |
} elsif ( $last_number - $last_translated_number >= $min_versions ) { |
| 209 |
return "The original is newer than this translation"; |
return '<gettext domain="stats">The original is newer than this translation</gettext>'; |
| 210 |
} |
} |
| 211 |
} elsif ( !$version && $translation) { |
} elsif ( !$version && $translation) { |
| 212 |
return "The original no longer exists"; |
return '<gettext domain="stats">The original no longer exists</gettext>'; |
| 213 |
} |
} |
| 214 |
return ""; |
return ""; |
| 215 |
} |
} |
| 239 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 240 |
next if $lang eq 'english'; |
next if $lang eq 'english'; |
| 241 |
$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; |
| 242 |
|
$percent_po_t{'total'}{$lang} = 0; |
| 243 |
|
$percent_po_f{'total'}{$lang} = 0; |
| 244 |
|
$percent_po_u{'total'}{$lang} = 100; |
| 245 |
|
if (! -d "$opt_w/$lang/po") { |
| 246 |
|
print "$0: can't find $opt_w/$lang/po! Skipping ...\n"; |
| 247 |
|
next; |
| 248 |
|
} |
| 249 |
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,; |
| 250 |
foreach $line (@status) { |
foreach $line (@status) { |
| 251 |
chomp $line; |
chomp $line; |
| 267 |
} else { |
} else { |
| 268 |
$percent_po_t{$domain}{$lang} = 0; |
$percent_po_t{$domain}{$lang} = 0; |
| 269 |
$percent_po_f{$domain}{$lang} = 0; |
$percent_po_f{$domain}{$lang} = 0; |
| 270 |
$percent_po_u{$domain}{$lang} = 0; |
$percent_po_u{$domain}{$lang} = 0; # or 100 if po/ doesn't exist |
| 271 |
} |
} |
| 272 |
} |
} |
| 273 |
$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}; |
| 276 |
$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); |
| 277 |
$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); |
| 278 |
$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; |
|
| 279 |
} |
} |
| 280 |
} |
} |
| 281 |
print "done.\n" if ($config{'verbose'}); |
print "done.\n" if ($config{'verbose'}); |
| 283 |
# =============== Create HTML files =============== |
# =============== Create HTML files =============== |
| 284 |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
| 285 |
|
|
| 286 |
my @filenames = sort keys %files; |
# Read website hit statistics, if available |
| 287 |
|
my %hits; |
| 288 |
|
my $file_sorter = sub($$) { $_[0] cmp $_[1] }; |
| 289 |
|
if ($config{'hit_file'} and $config{'hit_file'} =~ m{^(f|ht)tps?://} and ! $udd_available) { |
| 290 |
|
warn "Disabling fetching of hit data.\n"; |
| 291 |
|
$config{'hit_file'} = undef; |
| 292 |
|
} |
| 293 |
|
if ($config{'hit_file'}) { |
| 294 |
|
if ($config{'hit_file'} =~ m{^(f|ht)tps?://}) { |
| 295 |
|
printf("Retrieving hit data from [%s].\n", $config{'hit_file'}) if ($config{'verbose'}); |
| 296 |
|
my $json = LWP::Simple::get($config{'hit_file'}); |
| 297 |
|
if ($json) { |
| 298 |
|
my $perl = JSON::from_json($json, {utf8 => 1}); |
| 299 |
|
foreach my $e (@{$perl->{'r'}}) { |
| 300 |
|
my ($count, $url) = @$e; |
| 301 |
|
last if $count < 3; # URLS with 2 or 1 hits are most likely mistakes; let's not waste RAM on them |
| 302 |
|
$hits{substr($url, 1)} = $count; |
| 303 |
|
} |
| 304 |
|
} else { |
| 305 |
|
warn "Retrieving hit data failed.\n"; |
| 306 |
|
} |
| 307 |
|
} else { |
| 308 |
|
open(HITS, $config{'hit_file'}) or die sprintf("Opening hit file [%s] failed: $!", $config{'hit_file'}); |
| 309 |
|
printf "Reading hit file [%s]\n", $config{'hit_file'} if ($config{'verbose'}); |
| 310 |
|
foreach my $hit_line (<HITS>) { |
| 311 |
|
chomp $hit_line; |
| 312 |
|
$hit_line =~ /^\s*(\d+)\s+(.*)/ or warn sprintf("unrecognized hit file [%s] line [%s]", $config{'hit_file'}, $hit_line); |
| 313 |
|
my ($count, $url) = ($1, $2); |
| 314 |
|
last if $count < 3; # URLS with 2 or 1 hits are most likely mistakes; let's not waste RAM on them |
| 315 |
|
$hits{substr($url, 1)} = $count; |
| 316 |
|
} |
| 317 |
|
close(HITS) or die sprintf("Closing hit file [%s] failed: $!", $config{'hit_file'}); |
| 318 |
|
} |
| 319 |
|
if (%hits) { |
| 320 |
|
$file_sorter = sub($$) { |
| 321 |
|
my ($a, $b) = @_; |
| 322 |
|
$a =~ s/\.wml$//o; |
| 323 |
|
$b =~ s/\.wml$//o; |
| 324 |
|
$hits{$b} <=> $hits{$a} |
| 325 |
|
}; |
| 326 |
|
} else { |
| 327 |
|
print "Tables will be sorted alphabetically.\n" if ($config{'verbose'}); |
| 328 |
|
} |
| 329 |
|
} else { |
| 330 |
|
print "No hit file specified. Tables will be sorted alphabetically.\n" if ($config{'verbose'}); |
| 331 |
|
} |
| 332 |
|
|
| 333 |
|
my @filenames = sort $file_sorter keys %files; |
| 334 |
my $nfiles = scalar @filenames; |
my $nfiles = scalar @filenames; |
| 335 |
$nsize += $sizes{$_} foreach (@filenames); |
$nsize += $sizes{$_} foreach (@filenames); |
| 336 |
|
|
| 337 |
|
my $firstdifftype; |
| 338 |
|
my $seconddifftype; |
| 339 |
|
if ($config{'difftype'} eq 'u') { |
| 340 |
|
$firstdifftype = 'u'; |
| 341 |
|
$seconddifftype = 'h'; |
| 342 |
|
} else { |
| 343 |
|
$firstdifftype = 'h'; |
| 344 |
|
$seconddifftype = 'u'; |
| 345 |
|
} |
| 346 |
|
|
| 347 |
print "Creating files: " if ($config{'verbose'}); |
print "Creating files: " if ($config{'verbose'}); |
| 348 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 349 |
my @processed_langs = ($langs{$lang}); |
my @processed_langs = ($langs{$lang}); |
| 350 |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 351 |
foreach $l (@processed_langs) { |
foreach $l (@processed_langs) { |
| 352 |
print "$l.html " if ($config{'verbose'}); |
print "$l.wml " if ($config{'verbose'}); |
| 353 |
|
|
| 354 |
|
$charset{$lang}; |
| 355 |
|
open (wmlrc,"$opt_w/$lang/.wmlrc") ; |
| 356 |
|
while (<wmlrc>) { |
| 357 |
|
if ( /^-D CHARSET=(.*)$/ ) { |
| 358 |
|
$charset{$lang} = $1; |
| 359 |
|
} |
| 360 |
|
} |
| 361 |
|
close wmlrc ; |
| 362 |
|
|
| 363 |
$t_body = $u_body = $o_body = ""; |
$t_body = $u_body = $ui_body = $un_body = $uu_body = $o_body = ""; |
| 364 |
$translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0; |
$translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0; |
| 365 |
|
|
| 366 |
# get stats about files |
# get stats about files |
| 367 |
foreach $file (@filenames) { |
foreach $file (@filenames) { |
| 368 |
next if ($file eq ""); |
next if ($file eq ""); |
| 369 |
|
(my $base = $file) =~ s/\.wml$//; |
| 370 |
|
my $hits = exists $hits{$base} ? $hits{$base}.' <gettext domain="stats">hits</gettext>' : '<gettext domain="stats">hit count N/A</gettext>'; |
| 371 |
# Translated pages |
# Translated pages |
| 372 |
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
| 373 |
$translated{$lang}++; |
$translated{$lang}++; |
| 381 |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 382 |
$o_body .= sprintf "<td>%s</td>", $file; |
$o_body .= sprintf "<td>%s</td>", $file; |
| 383 |
} else { |
} else { |
| 384 |
(my $base = $file) =~ s/\.wml$//; |
$o_body .= sprintf "<td><a title=\"%s\" href=\"$opt_b/%s.%s.html\">%s</a></td>", $hits, $base, $l, $base; |
|
$o_body .= sprintf "<td><a href=\"$opt_b/%s.%s.html\">%s</a></td>", $base, $l, $base; |
|
| 385 |
} |
} |
| 386 |
$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"}; |
$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"}; |
| 387 |
$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"}; |
$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"}; |
| 388 |
$o_body .= sprintf "<td>%s</td>", $msg; |
$o_body .= sprintf "<td>%s</td>", $msg; |
| 389 |
if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") { |
$o_body .= sprintf '<td style=\'font-family: monospace\' title=\'<gettext domain="stats">Click to fetch diffstat data</gettext>\' onClick="setDiffstat(\'%s\', \'%s\', \'%s\', this)">+/-</td>', $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 390 |
|
if ($msg eq '<gettext domain="stats">Wrong translation version</gettext>' || $msg eq '<gettext domain="stats">The original no longer exists</gettext>') { |
| 391 |
$o_body .= "<td></td><td></td>"; |
$o_body .= "<td></td><td></td>"; |
| 392 |
} else { |
} else { |
| 393 |
$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://alioth.debian.org/scm/viewvc.php/webwml/$orig/%s?root=webwml\&view=diff\&r1=%s\&r2=%s\&diff_format=%s\">%s\ ->\ %s</a></td>", |
| 394 |
$o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s?cvsroot=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"}; |
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 395 |
|
$o_body .= sprintf "<td><a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/$orig/%s?root=webwml\&view=diff\&r1=%s\&r2=%s\&diff_format=%s\">%s\ ->\ %s</a></td>", |
| 396 |
|
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 397 |
} |
} |
| 398 |
|
$o_body .= sprintf "<td><a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/$orig/%s?root=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"}; |
| 399 |
|
$o_body .= sprintf "<td><a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/%s/%s?root=webwml\&view=markup\">[V]</a>\ ", $lang, $file; |
| 400 |
|
$o_body .= sprintf "<a href=\"http://alioth.debian.org/scm/viewvc.php/*checkout*/webwml/%s/%s?root=webwml\">[F]</a></td>", $lang, $file; |
| 401 |
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
| 402 |
$o_body .= "</tr>\n"; |
$o_body .= "</tr>\n"; |
| 403 |
$outdated{$lang}++; |
$outdated{$lang}++; |
| 408 |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 409 |
$t_body .= sprintf "<li>%s</li>\n", $file; |
$t_body .= sprintf "<li>%s</li>\n", $file; |
| 410 |
} else { |
} else { |
| 411 |
(my $base = $file) =~ s/\.wml$//; |
$t_body .= sprintf "<li><a title=\"%s\" href=\"$opt_b/%s.%s.html\">%s</a></li>\n", $hits, $base, $l, $base; |
|
$t_body .= sprintf "<li><a href=\"$opt_b/%s.%s.html\">%s</a></li>\n", $base, $l, $base; |
|
| 412 |
} |
} |
| 413 |
} |
} |
| 414 |
} |
} |
| 415 |
# Untranslated pages |
# Untranslated pages |
| 416 |
else { |
else { |
| 417 |
|
my $u_tmp; |
| 418 |
if (($file !~ /\.wml$/) |
if (($file !~ /\.wml$/) |
| 419 |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 420 |
$u_body .= sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
$u_tmp = sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
| 421 |
} else { |
} else { |
| 422 |
(my $base = $file) =~ s/\.wml$//; |
$u_tmp = sprintf "<tr><td><a title=\"%s\" href=\"$opt_b/%s\">%s (%s)</a></td><td align=\"right\">%d</td><td>(%.2f ‰)</td></tr>\n", $hits, $base, $base, $version{"$orig/$file"}, $sizes{$file}, $sizes{$file}/$nsize * 1000; |
|
$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; |
|
| 423 |
} |
} |
| 424 |
|
if (($file =~ /international\//) && |
| 425 |
|
(($file !~ /international\/index.wml$/) || |
| 426 |
|
($file !~ /international\/l10n\//))) { |
| 427 |
|
$ui_body .=$u_tmp; |
| 428 |
|
} elsif ((($file =~ /(News|events|security|vote)\/[0-9]{4}\//) && |
| 429 |
|
($file !~ /index.wml$/)) || |
| 430 |
|
($file =~ /(News\/weekly\/[0-9]{4}\/|security\/undated)/)) { |
| 431 |
|
$un_body .= $u_tmp; |
| 432 |
|
} elsif (($file =~ /(consultants|users\/(com|edu|gov|org))\//) && |
| 433 |
|
($file !~ /index.wml$/)) { |
| 434 |
|
$uu_body .=$u_tmp; |
| 435 |
|
} else { |
| 436 |
|
$u_body .= $u_tmp; |
| 437 |
|
} |
| 438 |
$untranslated{$lang}++; |
$untranslated{$lang}++; |
| 439 |
$untranslated_s{$lang} += $sizes{$file}; |
$untranslated_s{$lang} += $sizes{$file}; |
| 440 |
} |
} |
| 450 |
$translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang}; |
$translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang}; |
| 451 |
|
|
| 452 |
if ($nfiles > 0) { |
if ($nfiles > 0) { |
| 453 |
$percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5); |
$percent_a{$lang} = $wml{$lang}/$nfiles * 100; |
|
$percent_as{$lang} = (int ($wml_s{$lang}/$nsize * 1000 + 5))/10; |
|
| 454 |
} else { |
} else { |
| 455 |
$percent_a{$lang} = 0; |
$percent_a{$lang} = 0; |
| 456 |
|
} |
| 457 |
|
if ($nsize > 0) { |
| 458 |
|
$percent_as{$lang} = $wml_s{$lang}/$nsize * 100; |
| 459 |
|
} else { |
| 460 |
$percent_as{$lang} = 0; |
$percent_as{$lang} = 0; |
| 461 |
} |
} |
| 462 |
if ($wml{$lang} > 0) { |
if ($wml{$lang} > 0) { |
| 463 |
$percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5); |
$percent_t{$lang} = $translated{$lang}/$wml{$lang} * 100; |
|
$percent_ts{$lang} = (int ($translated_s{$lang}/($wml_s{$lang}+1) * 1000 + 5))/10; |
|
| 464 |
} else { |
} else { |
| 465 |
$percent_t{$lang} = 0; |
$percent_t{$lang} = 0; |
| 466 |
|
} |
| 467 |
|
if ($wml_s{$lang} > 0) { |
| 468 |
|
$percent_ts{$lang} = $translated_s{$lang}/$wml_s{$lang} * 100; |
| 469 |
|
} else { |
| 470 |
$percent_ts{$lang} = 0; |
$percent_ts{$lang} = 0; |
| 471 |
} |
} |
| 472 |
$percent_o{$lang} = 100 - $percent_t{$lang}; |
$percent_o{$lang} = 100 - $percent_t{$lang}; |
| 474 |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
| 475 |
$percent_us{$lang} = 100 - $percent_as{$lang}; |
$percent_us{$lang} = 100 - $percent_as{$lang}; |
| 476 |
|
|
| 477 |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
if (open (HTML, ">$config{'htmldir'}/$l.wml")) { |
| 478 |
printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"; |
printf HTML "#use wml::debian::template title=\"<:=\$trans{\$CUR_ISO_LANG}{%s}:>\"\n", $lang; |
| 479 |
# printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang; |
print HTML "#use wml::debian::toc\n"; |
| 480 |
printf HTML "<html>\n<head>\n"; |
print HTML "<script src='diffstat.js' type='text/javascript'></script>\n\n"; |
|
printf HTML " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"; |
|
|
printf HTML " <title>%s: %s</title>\n", $config{'title'}, ucfirst $lang; |
|
|
print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
|
|
print HTML "</head>\n<body>\n"; |
|
| 481 |
$color = get_color ($percent_a{$lang}); |
$color = get_color ($percent_a{$lang}); |
| 482 |
|
|
| 483 |
printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color; |
printf HTML '<table summary="<gettext domain="stats">Translation summary for</gettext> <:=$trans{$CUR_ISO_LANG}{'.$lang.'} :>" style="background-color: %s; width: 100%; font-weight: bold; margin: 0; text-align: center;">'."\n", $color; |
|
printf HTML "%s: %s</h1>\n", $config{'title'}, ucfirst $lang; |
|
|
printf HTML "<table summary=\"Translation Summary for $lang\" style=\"background-color: %s\; width: 100%\; font-weight: bold\; margin: 0\; text-align: center\;\">\n", $color; |
|
| 484 |
print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n"; |
print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n"; |
|
# printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang; |
|
| 485 |
|
|
| 486 |
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><gettext domain="stats">Translated</gettext></th><th><gettext domain="stats">Up to date</gettext></th><th><gettext domain="stats">Outdated</gettext></th><th><gettext domain="stats">Not translated</gettext></th></tr>'."\n<tr>\n"; |
| 487 |
printf HTML "<td>%d files (%d%%)</td>", $wml{$lang}, $percent_a{$lang}; |
printf HTML '<td>%d <gettext domain="stats">files</gettext> (%.1f%%)</td>', $wml{$lang}, $percent_a{$lang}; |
| 488 |
printf HTML "<td>%d files (%d%%)</td>", $translated{$lang}, $percent_t{$lang}; |
printf HTML '<td>%d <gettext domain="stats">files</gettext> (%.1f%%)</td>', $translated{$lang}, $percent_t{$lang}; |
| 489 |
printf HTML "<td>%d files (%d%%)</td>", $outdated{$lang}, $percent_o{$lang}; |
printf HTML '<td>%d <gettext domain="stats">files</gettext> (%.1f%%)</td>', $outdated{$lang}, $percent_o{$lang}; |
| 490 |
printf HTML "<td>%d files (%d%%)</td>", $untranslated{$lang}, $percent_u{$lang}; |
printf HTML '<td>%d <gettext domain="stats">files</gettext> (%.1f%%)</td>', $untranslated{$lang}, $percent_u{$lang}; |
| 491 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 492 |
print HTML "<tr>\n"; |
print HTML "<tr>\n"; |
| 493 |
printf HTML "<td>%d bytes (%.1f%%)</td>", $wml_s{$lang}, $percent_as{$lang}; |
printf HTML '<td>%d <gettext domain="stats">bytes</gettext> (%.1f%%)</td>', $wml_s{$lang}, $percent_as{$lang}; |
| 494 |
printf HTML "<td>%d bytes (%.1f%%)</td>", $translated_s{$lang}, $percent_ts{$lang}; |
printf HTML '<td>%d <gettext domain="stats">bytes</gettext> (%.1f%%)</td>', $translated_s{$lang}, $percent_ts{$lang}; |
| 495 |
printf HTML "<td>%d bytes (%.1f%%)</td>", $outdated_s{$lang}, $percent_os{$lang}; |
printf HTML '<td>%d <gettext domain="stats">bytes</gettext> (%.1f%%)</td>', $outdated_s{$lang}, $percent_os{$lang}; |
| 496 |
printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang}; |
printf HTML '<td>%d <gettext domain="stats">bytes</gettext> (%.1f%%)</td>', $nsize-$wml_s{$lang}, $percent_us{$lang}; |
| 497 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 498 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 499 |
|
|
| 500 |
# Make the table of content |
# Make the table of content |
| 501 |
print HTML "<h3>Table of Contents</h3>\n"; |
print HTML "<toc-display/>\n"; |
| 502 |
print HTML "<ul>\n"; |
if (%hits) { |
| 503 |
print HTML "<li><a href=\"./\">Back to index of languages</a></li>\n"; |
print HTML '<p><gettext domain="stats">Note: the lists of pages are sorted by popularity. Hover over the page name to see the number of hits.</gettext></p>'."\n"; |
|
print HTML "<li><a href=\"../\">Working on the website</a></li>\n"; |
|
|
if ($o_body) { |
|
|
print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n"; |
|
|
} |
|
|
if ($u_body) { |
|
|
print HTML "<li><a href=\"#untranslated\">Pages not translated</a></li>\n"; |
|
| 504 |
} |
} |
|
if ($t_body) { |
|
|
print HTML "<li><a href=\"#uptodate\">Translations up to date</a></li>\n"; |
|
|
} |
|
|
if ($lang ne 'english') { |
|
|
print HTML "<li><a href=\"#gettext\">Translations of templates (gettext files)</a></li>\n"; |
|
|
} |
|
|
print HTML "</ul>\n"; |
|
| 505 |
|
|
| 506 |
# outputs the content |
# outputs the content |
| 507 |
if ($o_body) { |
if ($o_body) { |
| 508 |
print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML '<toc-add-entry name="outdated"><gettext domain="stats">Outdated translations</gettext></toc-add-entry>'."\n"; |
| 509 |
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"; |
| 510 |
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
print HTML '<tr><th><gettext domain="stats">File</gettext></th>'."\n"; |
| 511 |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
print HTML '<th><gettext domain="stats">Translation</gettext></th>'."\n"; |
| 512 |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
print HTML '<th><gettext domain="stats">Origin</gettext></th>'."\n"; |
| 513 |
else { print HTML "<th>Diff</th>"; } |
print HTML '<th><gettext domain="stats">Comment</gettext></th>'."\n"; |
| 514 |
print HTML "<th>Log</th>"; |
print HTML '<th><gettext domain="stats">Diffstat</gettext></th>'."\n"; |
| 515 |
print HTML "<th>Maintainer</th>"; |
if ($opt_d eq "u") { print HTML '<th><gettext domain="stats">Unified diff</gettext></th><th><gettext domain="stats">Colored diff</gettext></th>'; } |
| 516 |
|
elsif ($opt_d eq "h") { print HTML '<th><gettext domain="stats">Colored diff</gettext></th><th><gettext domain="stats">Unified diff</gettext></th>'; } |
| 517 |
|
else { print HTML '<th><gettext domain="stats">Diff</gettext></th>'; } |
| 518 |
|
print HTML '<th><gettext domain="stats">Log</gettext></th>'; |
| 519 |
|
print HTML '<th><gettext domain="stats">Translation</gettext></th>'; |
| 520 |
|
print HTML '<th><gettext domain="stats">Maintainer</gettext></th>'; |
| 521 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 522 |
print HTML $o_body; |
print HTML $o_body; |
| 523 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 524 |
} |
} |
| 525 |
if ($u_body) { |
if ($u_body) { |
| 526 |
print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML '<toc-add-entry name="untranslated"><gettext domain="stats">General pages not translated</gettext></toc-add-entry>'."\n"; |
| 527 |
print HTML "<table summary=\"Untranslated Pages\">\n"; |
print HTML '<table summary="<gettext domain="stats">Untranslated general pages</gettext>">'."\n"; |
| 528 |
print HTML $u_body; |
print HTML $u_body; |
| 529 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 530 |
|
} |
| 531 |
|
if ($un_body) { |
| 532 |
|
print HTML '<toc-add-entry name="untranslated-news"><gettext domain="stats">News items not translated</gettext></toc-add-entry>'."\n"; |
| 533 |
|
print HTML '<table summary="<gettext domain="stats">Untranslated news items</gettext>">'."\n"; |
| 534 |
|
print HTML $un_body; |
| 535 |
|
print HTML "</table>\n"; |
| 536 |
|
} |
| 537 |
|
if ($uu_body) { |
| 538 |
|
print HTML '<toc-add-entry name="untranslated-user"><gettext domain="stats">Consultant/user pages not translated</gettext></toc-add-entry>'."\n"; |
| 539 |
|
print HTML '<table summary="<gettext domain="stats">Untranslated consultant/user pages</gettext>">'."\n"; |
| 540 |
|
print HTML $uu_body; |
| 541 |
|
print HTML "</table>\n"; |
| 542 |
|
} |
| 543 |
|
if ($ui_body) { |
| 544 |
|
print HTML '<toc-add-entry name="untranslated-l10n"><gettext domain="stats">International pages not translated</gettext></toc-add-entry>'."\n"; |
| 545 |
|
print HTML '<table summary="<gettext domain="stats">Untranslated international pages</gettext>">'."\n"; |
| 546 |
|
print HTML $ui_body; |
| 547 |
|
print HTML "</table>\n"; |
| 548 |
} |
} |
| 549 |
if ($t_body) { |
if ($t_body) { |
| 550 |
print HTML "<h3><a name='uptodate'>Translations up to date</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML '<toc-add-entry name="uptodate"><gettext domain="stats">Translated pages (up-to-date)</gettext></toc-add-entry>'."\n"; |
| 551 |
print HTML "<ul class=\"discless\">\n"; |
print HTML "<ul class=\"discless\">\n"; |
| 552 |
print HTML $t_body; |
print HTML $t_body; |
| 553 |
print HTML "</ul>\n"; |
print HTML "</ul>\n"; |
| 554 |
} |
} |
| 555 |
# outputs the gettext stats |
# outputs the gettext stats |
| 556 |
if ($lang ne 'english') { |
if ($lang ne 'english') { |
| 557 |
print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n"; |
print HTML '<toc-add-entry name="gettext"><gettext domain="stats">Translated templates (PO files)</gettext></toc-add-entry>'."\n"; |
| 558 |
# print HTML $border_head; |
print HTML '<table summary="<gettext domain="stats">PO Translation Statistics</gettext>" width="100%">'."\n"; |
| 559 |
print HTML "<table summary=\"Gettext Statistics\" width=\"100%\">\n"; |
print HTML '<tr><th><gettext domain="stats">File</gettext></th>'."\n"; |
| 560 |
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
print HTML '<th><gettext domain="stats">Up to date</gettext></th>'."\n"; |
| 561 |
|
print HTML '<th><gettext domain="stats">Fuzzy</gettext></th>'."\n"; |
| 562 |
|
print HTML '<th><gettext domain="stats">Untranslated</gettext></th>'."\n"; |
| 563 |
|
print HTML '<th><gettext domain="stats">Total</gettext></th></tr>'."\n"; |
| 564 |
foreach my $domain (sort keys %po_total) { |
foreach my $domain (sort keys %po_total) { |
| 565 |
next if $domain eq 'total'; |
next if $domain eq 'total'; |
| 566 |
print HTML "<tr>"; |
print HTML "<tr>"; |
| 576 |
printf HTML "<td align=right>%d</td>", $po_total{$domain}; |
printf HTML "<td align=right>%d</td>", $po_total{$domain}; |
| 577 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 578 |
} |
} |
| 579 |
print HTML "<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><th>Total:</th>"; |
print HTML "<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr>\n"; |
| 580 |
|
print HTML '<tr><th><gettext domain="stats">Total:</gettext></th>'; |
| 581 |
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 582 |
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 583 |
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 586 |
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}; |
| 587 |
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
| 588 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 589 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 590 |
} |
} |
| 591 |
|
|
| 592 |
# outputs footer |
print HTML '<address><gettext domain="stats">Created with</gettext> <a href="http://alioth.debian.org/scm/viewvc.php/webwml/stattrans.pl?view=markup&root=webwml">webwml-stattrans</a></address>'."\n"; |
|
print HTML "<hr><address>Compiled at $date</address>\n"; |
|
|
print HTML "</body></html>"; |
|
| 593 |
close (HTML); |
close (HTML); |
| 594 |
|
} else { |
| 595 |
|
print "Can't open $config{'htmldir'}/$l.wml\n"; |
| 596 |
} |
} |
| 597 |
} |
} |
| 598 |
} |
} |
| 599 |
print "\n" if ($config{'verbose'}); |
print "\n" if ($config{'verbose'}); |
| 600 |
|
|
| 601 |
# =============== Creating index.html =============== |
# =============== Creating index.html =============== |
| 602 |
print "Creating index.html... " if ($config{'verbose'}); |
print "Creating index.wml... " if ($config{'verbose'}); |
| 603 |
|
|
| 604 |
open (HTMLI, ">$config{'htmldir'}/index.html") |
open (HTMLI, ">$config{'htmldir'}/index.wml") |
| 605 |
|| die "Can't open $config{'htmldir'}/index.html"; |
|| die "Can't open $config{'htmldir'}/index.wml"; |
| 606 |
|
|
| 607 |
# printf HTMLI "<html>\n<head><title>%s</title></head>\n<body bgcolor=\"#ffffff\">\n", $config{'title'}; |
print HTMLI "#use wml::debian::stats_tags\n"; |
| 608 |
# printf HTMLI "<h1 align=\"center\">%s</h1>\n", $config{'title'}; |
printf HTMLI "#use wml::debian::template title=\"%s\"\n\n", $config{'title'}; |
| 609 |
printf HTMLI "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n"; |
print HTMLI '<h2><gettext domain="stats">Translated web pages</gettext></h2>'."\n"; |
| 610 |
printf HTMLI " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"; |
printf HTMLI "<p><stats_pages %d></p>\n",($wml{'english'}+$untranslated{'english'}); |
|
printf HTMLI " <title>%s</title>\n", $config{'title'}; |
|
|
print HTMLI " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
|
|
printf HTMLI "</head>\n<body>\n"; |
|
|
printf HTMLI "<h1>%s</h1>\n", $config{'title'}; |
|
|
print HTMLI "<h2>Translated web pages</h2>\n"; |
|
|
printf HTMLI "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
|
| 611 |
|
|
| 612 |
# print HTMLI $border_head; |
print HTMLI '<table summary="<gettext domain="stats">Translation Statistics by Page Count</gettext>" class="stattrans">'."\n"; |
|
print HTMLI "<table summary=\"Translation Statistics by Page Count\" class=\"stattrans\">\n"; |
|
| 613 |
print HTMLI "<colgroup width=\"20%\">\n"; |
print HTMLI "<colgroup width=\"20%\">\n"; |
| 614 |
print HTMLI "<col>\n"; |
print HTMLI "<col>\n"; |
| 615 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 624 |
print HTMLI "<col width=\"10%\">\n"; |
print HTMLI "<col width=\"10%\">\n"; |
| 625 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 626 |
print HTMLI "<thead>"; |
print HTMLI "<thead>"; |
| 627 |
print HTMLI "<tr><th>Language</th><th colspan=\"2\">Translations</th><th colspan=\"2\">Up to date</th><th colspan=\"2\">Outdated</th><th colspan=\"2\">Not translated</th></tr>\n"; |
print HTMLI '<tr><th><gettext domain="stats">Language</gettext></th>'."\n"; |
| 628 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Translations</gettext></th>'."\n"; |
| 629 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Up to date</gettext></th>'."\n"; |
| 630 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Outdated</gettext></th>'."\n"; |
| 631 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Not translated</gettext></th></tr>'."\n"; |
| 632 |
print HTMLI "</thead>"; |
print HTMLI "</thead>"; |
| 633 |
print HTMLI "<tbody>"; |
print HTMLI "<tbody>"; |
| 634 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 641 |
$color_u = get_color (100 - $percent_u{$lang}); |
$color_u = get_color (100 - $percent_u{$lang}); |
| 642 |
|
|
| 643 |
print HTMLI "<tr>"; |
print HTMLI "<tr>"; |
| 644 |
printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
printf HTMLI "<th><a href=\"%s\"><:=\$trans{\$CUR_ISO_LANG}{%s} :></a> (%s)</th>", $l, $lang, $l; |
| 645 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_a, $wml{$lang}, format3($percent_a{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang}; |
| 646 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_t, $translated{$lang}, format3($percent_t{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang}; |
| 647 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_o, $outdated{$lang}, format3($percent_o{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang}; |
| 648 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_u, $untranslated{$lang}, format3($percent_u{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang}; |
| 649 |
print HTMLI "</tr>\n"; |
print HTMLI "</tr>\n"; |
| 650 |
} |
} |
| 651 |
} |
} |
| 652 |
print HTMLI "</tbody>"; |
print HTMLI "</tbody>"; |
| 653 |
print HTMLI "</table>\n"; |
print HTMLI "</table>\n"; |
|
# print HTMLI $border_foot; |
|
| 654 |
|
|
| 655 |
print HTMLI "<h2>Translated web pages (by size)</h2>\n"; |
print HTMLI '<h2><gettext domain="stats">Translated web pages (by size)</gettext></h2>'."\n"; |
| 656 |
printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'}); |
printf HTMLI "<p><stats_bytes %d></p>\n",($wml_s{'english'}+$untranslated_s{'english'}); |
| 657 |
|
|
| 658 |
# print HTMLI $border_head; |
print HTMLI '<table summary="<gettext domain="stats">Translation Statistics by Page Size</gettext>" class="stattrans">'."\n"; |
|
print HTMLI "<table summary=\"Translation Statistics by Page Size\" class=\"stattrans\">\n"; |
|
|
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
|
| 659 |
print HTMLI "<colgroup span=\"1\">\n"; |
print HTMLI "<colgroup span=\"1\">\n"; |
| 660 |
print HTMLI "<col width=\"20%\">\n"; |
print HTMLI "<col width=\"20%\">\n"; |
| 661 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 670 |
print HTMLI "<col width=\"7%\">\n"; |
print HTMLI "<col width=\"7%\">\n"; |
| 671 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 672 |
print HTMLI "<thead>"; |
print HTMLI "<thead>"; |
| 673 |
print HTMLI "<tr><th>Language</th><th colspan=\"2\">Translations</th><th colspan=\"2\">Up to date</th><th colspan=\"2\">Outdated</th><th colspan=\"2\">Not translated</th></tr>\n"; |
print HTMLI '<tr><th><gettext domain="stats">Language</gettext></th>'."\n"; |
| 674 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Translations</gettext></th>'."\n"; |
| 675 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Up to date</gettext></th>'."\n"; |
| 676 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Outdated</gettext></th>'."\n"; |
| 677 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Not translated</gettext></th></tr>'."\n"; |
| 678 |
print HTMLI "</thead>"; |
print HTMLI "</thead>"; |
| 679 |
print HTMLI "<tbody>"; |
print HTMLI "<tbody>"; |
| 680 |
|
|
| 688 |
$color_u = get_color (100 - $percent_u{$lang}); |
$color_u = get_color (100 - $percent_u{$lang}); |
| 689 |
|
|
| 690 |
print HTMLI "<tr>"; |
print HTMLI "<tr>"; |
| 691 |
printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
printf HTMLI "<th><a href=\"%s\"><:=\$trans{\$CUR_ISO_LANG}{%s} :></a> (%s)</th>", $l, $lang, $l; |
| 692 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_a, $wml_s{$lang}, format5($percent_as{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml_s{$lang}, $percent_as{$lang}; |
| 693 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_t, $translated_s{$lang}, format5($percent_ts{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated_s{$lang}, $percent_ts{$lang}; |
| 694 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_o, $outdated_s{$lang}, format5($percent_os{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated_s{$lang}, $percent_os{$lang}; |
| 695 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_u, $wml_s{"english"}+$untranslated_s{'english'}-$wml_s{$lang}, format5($percent_us{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_u, $wml_s{"english"}+$untranslated_s{'english'}-$wml_s{$lang}, $percent_us{$lang}; |
| 696 |
print HTMLI "</tr>\n"; |
print HTMLI "</tr>\n"; |
| 697 |
} |
} |
| 698 |
} |
} |
| 699 |
print HTMLI "</tbody>"; |
print HTMLI "</tbody>"; |
| 700 |
print HTMLI "</table>\n"; |
print HTMLI "</table>\n"; |
|
# print HTMLI $border_foot; |
|
| 701 |
|
|
| 702 |
print HTMLI "<h2>Translated templates (gettext files)</h2>\n"; |
print HTMLI '<h2><gettext domain="stats">Translated templates (PO files)</gettext></h2>'."\n"; |
| 703 |
printf HTMLI "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
printf HTMLI "<p><stats_strings %d></p>\n",$po_total{'total'}; |
| 704 |
# print HTMLI $border_head; |
|
| 705 |
print HTMLI "<table summary=\"Gettext Translation Statistiks\"class=\"stattrans\">\n"; |
print HTMLI '<table summary="<gettext domain="stats">PO Translation Statistics</gettext>"class="stattrans">'."\n"; |
|
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
|
| 706 |
print HTMLI "<colgroup span=\"1\"width=\"28%\">\n"; |
print HTMLI "<colgroup span=\"1\"width=\"28%\">\n"; |
| 707 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 708 |
print HTMLI "<colgroup span=\"6\" width=\"12%\">\n"; |
print HTMLI "<colgroup span=\"6\" width=\"12%\">\n"; |
| 714 |
print HTMLI "<col width=\"12%\">\n"; |
print HTMLI "<col width=\"12%\">\n"; |
| 715 |
print HTMLI "</colgroup>"; |
print HTMLI "</colgroup>"; |
| 716 |
print HTMLI "<thead>"; |
print HTMLI "<thead>"; |
| 717 |
print HTMLI "<tr><th>Language</th><th colspan=\"2\">Up to date</th><th colspan=\"2\">Fuzzy</th><th colspan=\"2\">Not translated</th></tr>\n"; |
print HTMLI '<tr><th><gettext domain="stats">Language</gettext></th>'."\n"; |
| 718 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Up to date</gettext></th>'."\n"; |
| 719 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Fuzzy</gettext></th>'."\n"; |
| 720 |
|
print HTMLI '<th colspan="2"><gettext domain="stats">Not translated</gettext></th></tr>'."\n"; |
| 721 |
print HTMLI "</thead>"; |
print HTMLI "</thead>"; |
| 722 |
print HTMLI "<tbody>"; |
print HTMLI "<tbody>"; |
| 723 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 726 |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 727 |
foreach $l (@processed_langs) { |
foreach $l (@processed_langs) { |
| 728 |
print HTMLI "<tr>"; |
print HTMLI "<tr>"; |
| 729 |
printf HTMLI "<th><a href=\"%s.html#gettext\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
printf HTMLI "<th><a href=\"%s#gettext\"><:=\$trans{\$CUR_ISO_LANG}{%s} :></a> (%s)</th>", $l, $lang, $l; |
| 730 |
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 731 |
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 732 |
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 733 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_t, $po_translated{'total'}{$lang}, format3($percent_po_t{'total'}{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
| 734 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, format3($percent_po_f{'total'}{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
| 735 |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%s%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, format3($percent_po_u{'total'}{$lang}); |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 736 |
print HTMLI "</tr>\n"; |
print HTMLI "</tr>\n"; |
| 737 |
} |
} |
| 738 |
} |
} |
| 739 |
|
|
| 740 |
print HTMLI "</tbody>"; |
print HTMLI "</tbody>"; |
| 741 |
print HTMLI "</table>\n"; |
print HTMLI "</table>\n"; |
|
# print HTMLI $border_foot; |
|
| 742 |
|
|
| 743 |
print HTMLI "<p><hr>\n"; |
print HTMLI '<address><gettext domain="stats">Created with</gettext> <a href="http://alioth.debian.org/scm/viewvc.php/webwml/stattrans.pl?view=markup&root=webwml">webwml-stattrans</a></address>'."\n"; |
|
print HTMLI "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n"; |
|
|
print HTMLI "</body></html>\n"; |
|
| 744 |
close (HTMLI); |
close (HTMLI); |
| 745 |
|
|
| 746 |
print "done.\n" if ($config{'verbose'}); |
print "done.\n" if ($config{'verbose'}); |