| 1 |
#! /usr/bin/perl |
#! /usr/bin/perl |
| 2 |
|
|
| 3 |
# webwml-stattrans - Debian Web site Translation Statistics |
# webwml-stattrans - Debian web site translation statistics |
| 4 |
# Copyright (c) 2001 Martin Schulze <joey@debian.org> and others |
# Copyright (c) 2001 Martin Schulze <joey@debian.org> and others |
| 5 |
|
|
| 6 |
# This program is free software; you can redistribute it and/or modify |
# This program is free software; you can redistribute it and/or modify |
| 19 |
|
|
| 20 |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
| 21 |
use Getopt::Std; |
use Getopt::Std; |
| 22 |
|
|
| 23 |
|
# These modules reside under webwml/Perl |
| 24 |
|
use lib ($0 =~ m|(.*)/|, $1 or ".") ."/Perl"; |
| 25 |
|
use Local::Cvsinfo; |
| 26 |
|
use Webwml::Langs; |
| 27 |
|
use Webwml::TransCheck; |
| 28 |
|
use Webwml::TransIgnore; |
| 29 |
|
|
| 30 |
$| = 1; |
$| = 1; |
| 31 |
|
|
| 32 |
$opt_h = "/org/www.debian.org/debian.org/devel/website/stats"; |
$opt_h = "/org/www.debian.org/www/devel/website/stats"; |
| 33 |
$opt_w = "/org/www.debian.org/webwml"; |
$opt_w = "/org/www.debian.org/webwml"; |
| 34 |
$opt_p = "*.wml"; |
$opt_p = "*.wml"; |
| 35 |
$opt_t = "Debian Web site Translation Statistics"; |
$opt_t = "Debian web site translation statistics"; |
| 36 |
$opt_v = 0; |
$opt_v = 0; |
| 37 |
$opt_d = "u"; |
$opt_d = "u"; |
| 38 |
$opt_l = undef; |
$opt_l = undef; |
| 39 |
getopts('h:w:p:t:vd:l:'); |
getopts('h:w:p:t:vd:l:') || die; |
| 40 |
|
# Replace filename globbing by Perl regexps |
| 41 |
|
$opt_p =~ s/\./\\./g; |
| 42 |
|
$opt_p =~ s/\?/./g; |
| 43 |
|
$opt_p =~ s/\*/.*/g; |
| 44 |
|
$opt_p =~ s/$/\$/g; |
| 45 |
%config = ( |
%config = ( |
| 46 |
'htmldir' => $opt_h, |
'htmldir' => $opt_h, |
| 47 |
'wmldir' => $opt_w, |
'wmldir' => $opt_w, |
| 48 |
'wmlpat' => $opt_p, |
'wmlpat' => $opt_p, |
| 49 |
'title' => $opt_t, |
'title' => $opt_t, |
| 50 |
'verbose' => $opt_v, |
'verbose' => $opt_v, |
| 51 |
'diff' => $opt_d, |
'difftype'=> $opt_d, |
| 52 |
); |
); |
| 53 |
|
|
| 54 |
$max_versions = 5; |
my $l = Webwml::Langs->new($opt_w); |
| 55 |
$min_versions = 1; |
my %langs = $l->name_iso(); |
| 56 |
|
|
| 57 |
|
my $transignore = Webwml::TransIgnore->new($opt_w); |
| 58 |
|
|
| 59 |
# from english/template/debian/languages.wml |
my $cvs = Local::Cvsinfo->new(); |
| 60 |
# TODO: Needs to be synced frequently or fixed so it's automatic |
$cvs->options( |
| 61 |
my %langs = ( english => "en", |
recursive => 1, |
| 62 |
# arabic => "ar", |
matchfile => [ $config{'wmlpat'} ], |
| 63 |
catalan => "ca", |
skipdir => [ "template" ], |
|
danish => "da", |
|
|
german => "de", |
|
|
greek => "el", |
|
|
esperanto => "eo", |
|
|
spanish => "es", |
|
|
finnish => "fi", |
|
|
french => "fr", |
|
|
croatian => "hr", |
|
|
hungarian => "hu", |
|
|
italian => "it", |
|
|
japanese => "ja", |
|
|
korean => "ko", |
|
|
dutch => "nl", |
|
|
norwegian => "no", |
|
|
polish => "pl", |
|
|
portuguese => "pt", |
|
|
romanian => "ro", |
|
|
russian => "ru", |
|
|
swedish => "sv", |
|
|
turkish => "tr", |
|
|
chinese => "zh", |
|
| 64 |
); |
); |
| 65 |
|
$cvs->readinfo("$config{'wmldir'}/english"); |
| 66 |
|
foreach (@{$transignore->global()}) { |
| 67 |
|
$cvs->removefile("$config{'wmldir'}/english/$_"); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
$border_head = "<table width=95% align=center border=0 cellpadding=0 cellspacing=0><tr bgcolor=#000000><td>" |
my $altcvs = Local::Cvsinfo->new(); |
| 71 |
."<table width=100% border=0 cellpadding=0 cellspacing=1><tr bgcolor=#ffffff><td>"; |
$altcvs->options( |
| 72 |
$border_foot = "</td></tr></table></td></tr></table>"; |
recursive => 1, |
| 73 |
|
matchfile => [ $config{'wmlpat'} ], |
| 74 |
|
skipdir => [ "template" ], |
| 75 |
|
); |
| 76 |
|
|
| 77 |
|
$max_versions = 5; |
| 78 |
|
$min_versions = 1; |
| 79 |
|
|
| 80 |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
$border_head = "<table width=\"95%\" align=\"center\" border=0 cellpadding=0 cellspacing=0><tr bgcolor=\"#000000\"><td>" |
| 81 |
|
."<table width=\"100%\" border=0 cellpadding=0 cellspacing=1><tr bgcolor=\"#ffffff\"><td>"; |
| 82 |
|
$border_foot = "</td></tr></table></td></tr></table>"; |
| 83 |
|
|
|
sub get_cvs_version |
|
|
{ |
|
|
my ($dir, $wmlfile) = @_; |
|
|
my $file; |
|
|
my @comp; |
|
|
my $version; |
|
|
|
|
|
@comp = split (/\//, "$dir/$wmlfile"); |
|
|
pop @comp; |
|
|
$dir = join ("/", @comp); |
|
|
|
|
|
@comp = split (/\//, "$wmlfile"); |
|
|
$file = pop @comp; |
|
|
|
|
|
if (open (CVS,"$dir/CVS/Entries")) { |
|
|
while (<CVS>) { |
|
|
($version) = $_ =~ m,/\Q$file\E/([\d\.]*),; |
|
|
last if $version; |
|
|
} |
|
|
} |
|
| 84 |
|
|
| 85 |
return $version; |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
|
} |
|
| 86 |
|
|
| 87 |
sub get_translation_version |
my %original; |
| 88 |
{ |
my %transversion; |
| 89 |
my ($dir, $file) = @_; |
my %version; |
| 90 |
my $checktrans; |
my %files; |
|
|
|
|
if (open (F, "$dir/$file")) { |
|
|
$checktrans = 0; |
|
|
while (<F>) { |
|
|
chomp; |
|
|
if (/^\#use wml::debian::translation-check/) { |
|
|
$checktrans = 1; |
|
|
return $1 if ($_ =~ /translation="([^\" ]+)"/); |
|
|
last; |
|
|
} |
|
|
} |
|
|
close (F); |
|
|
} |
|
|
return ""; |
|
|
} |
|
| 91 |
|
|
| 92 |
# Count wml files in given directory |
# Count wml files in given directory |
| 93 |
# |
# |
| 95 |
{ |
{ |
| 96 |
my $lang = shift; |
my $lang = shift; |
| 97 |
my $dir = "$config{'wmldir'}/$lang"; |
my $dir = "$config{'wmldir'}/$lang"; |
|
my $cmd = "find $dir -name \"$config{'wmlpat'}\""; |
|
| 98 |
my $cutfrom = length ($config{'wmldir'})+length($lang)+2; |
my $cutfrom = length ($config{'wmldir'})+length($lang)+2; |
| 99 |
my $count = 0; |
my $count = 0; |
| 100 |
my $is_english = ($lang eq "english")?1:0; |
my $is_english = ($lang eq "english")?1:0; |
| 101 |
my $file, $v; |
my $file, $v; |
| 102 |
|
my @listfiles; |
| 103 |
|
|
| 104 |
print "$lang " if ($config{verbose}); |
print "$lang " if ($config{verbose}); |
| 105 |
die "$0: can't find $dir!\n" if (! -d "$dir"); |
die "$0: can't find $dir!\n" if (! -d "$dir"); |
| 106 |
open (FIND, "$cmd|") || die "Can't read from $cmd"; |
if ($is_english) { |
| 107 |
while (<FIND>) { |
@listfiles = @{$cvs->files()}; |
| 108 |
# XXX this list of exceptions needs to be maintained XXX |
} else { |
| 109 |
next if (/\/sitemap\.wml/); |
$altcvs->reset(); |
| 110 |
next if (/\/template\//); |
$altcvs->readinfo($dir); |
| 111 |
next if (/\/MailingLists\/(un)?subscribe\.wml/); |
@listfiles = @{$altcvs->files()}; |
| 112 |
next if (/\/international\/l10n\/scripts\/l10nheader\.wml/); |
} |
| 113 |
chomp; |
foreach my $f (@listfiles) { |
| 114 |
$file = substr ($_, $cutfrom); |
$file = substr ($f, $cutfrom); |
| 115 |
|
next if $transignore->is_global($file); |
| 116 |
$file =~ s/\.wml$//; |
$file =~ s/\.wml$//; |
| 117 |
|
$files{$file} = 1; |
| 118 |
$wmlfiles{$lang} .= " " . $file; |
$wmlfiles{$lang} .= " " . $file; |
| 119 |
|
my $transcheck = Webwml::TransCheck->new("$dir/$file.wml"); |
| 120 |
|
if ($transcheck->revision()) { |
| 121 |
|
$transversion{"$lang/$file"} = $transcheck->revision(); |
| 122 |
|
$original{"$lang/$file"} ||= $transcheck->original(); |
| 123 |
|
} |
| 124 |
if ($is_english) { |
if ($is_english) { |
| 125 |
$version{"$lang/$file"} = get_cvs_version ($dir, "$file.wml"); |
$version{"$lang/$file"} = $cvs->revision($f); |
| 126 |
} else { |
} else { |
| 127 |
$version{"$lang/$file"} = get_translation_version ($dir, "$file.wml"); |
$version{"$lang/$file"} = $altcvs->revision($f); |
| 128 |
|
if (!$transcheck->revision()) { |
| 129 |
|
$original{"english/$file"} = $lang; |
| 130 |
|
$transversion{"english/$file"} ||= "1.1"; |
| 131 |
|
} |
| 132 |
|
} |
| 133 |
|
if ($transcheck->maintainer()) { |
| 134 |
|
$maintainer{"$lang/$file"} = $transcheck->maintainer(); |
| 135 |
} |
} |
| 136 |
$count++; |
$count++; |
| 137 |
} |
} |
| 138 |
close (FIND); |
close (FIND); |
| 139 |
$wmlfiles{$lang} .= " "; |
$wmlfiles{$lang} .= " "; |
| 140 |
$wml{$lang} = $count; |
$wml{$lang} = $count; |
| 141 |
} |
} |
| 142 |
|
|
| 143 |
sub get_color |
sub get_color |
| 144 |
{ |
{ |
| 189 |
|
|
| 190 |
print "Collecting data in: " if ($config{'verbose'}); |
print "Collecting data in: " if ($config{'verbose'}); |
| 191 |
if ($opt_l) { |
if ($opt_l) { |
|
getwmlfiles ('english'); |
|
| 192 |
getwmlfiles ($opt_l); |
getwmlfiles ($opt_l); |
|
} else { |
|
| 193 |
getwmlfiles ('english'); |
getwmlfiles ('english'); |
| 194 |
|
} else { |
| 195 |
foreach $lang (keys %langs) { |
foreach $lang (keys %langs) { |
|
next if ($lang eq "english"); |
|
| 196 |
getwmlfiles ($lang); |
getwmlfiles ($lang); |
| 197 |
} |
} |
| 198 |
} |
} |
| 199 |
print "\n" if ($config{'verbose'}); |
print "\n" if ($config{'verbose'}); |
| 200 |
|
|
| 201 |
|
my @search_in; |
| 202 |
|
if ($opt_l) { |
| 203 |
|
@search_in = ( 'english', $opt_l ); |
| 204 |
|
} else { |
| 205 |
|
@search_in = sort keys %langs; |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
# Compute stats about gettext files |
| 209 |
|
print "Computing statistics in gettext files... " if ($config{'verbose'}); |
| 210 |
|
my %po_translated,%po_fuzzy,%po_untranslated,%po_total; |
| 211 |
|
my %percent_po_t,%percent_po_u,%percent_po_f; |
| 212 |
|
foreach $lang (@search_in) { |
| 213 |
|
next if $lang eq 'english'; |
| 214 |
|
$l = $langs{$lang}; |
| 215 |
|
$po_translated{"total"}{$lang} = $po_fuzzy{"total"}{$lang} = $po_untranslated{"total"}{$lang} = 0; |
| 216 |
|
my @status = qx,LC_ALL=C make -C $opt_w/$lang/po stats 2>&1 1>/dev/null,; |
| 217 |
|
foreach $line (@status) { |
| 218 |
|
chomp $line; |
| 219 |
|
($domain = $line) =~ s/\..*//; |
| 220 |
|
$po_translated{$domain}{$lang} = ($line =~ /(\d+) translated/ ? $1 : "0"); |
| 221 |
|
$po_fuzzy{$domain}{$lang} = ($line =~ /(\d+) fuzzy/ ? $1 : "0"); |
| 222 |
|
$po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0"); |
| 223 |
|
|
| 224 |
|
$po_total{$domain} = $po_translated{$domain}{$lang} + $po_fuzzy{$domain}{$lang} + $po_untranslated{$domain}{$lang}; |
| 225 |
|
|
| 226 |
|
$po_translated{"total"}{$lang} += $po_translated{$domain}{$lang}; |
| 227 |
|
$po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang}; |
| 228 |
|
$po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang}; |
| 229 |
|
|
| 230 |
|
if ($po_total{$domain} > 0) { |
| 231 |
|
$percent_po_t{$domain}{$lang} = int ($po_translated{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
| 232 |
|
$percent_po_f{$domain}{$lang} = int ($po_fuzzy{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
| 233 |
|
$percent_po_u{$domain}{$lang} = int ($po_untranslated{$domain}{$lang}/$po_total{$domain} * 100 + .5); |
| 234 |
|
} else { |
| 235 |
|
$percent_po_t{$domain}{$lang} = 0; |
| 236 |
|
$percent_po_f{$domain}{$lang} = 0; |
| 237 |
|
$percent_po_u{$domain}{$lang} = 0; |
| 238 |
|
} |
| 239 |
|
} |
| 240 |
|
$po_total{"total"} = $po_translated{"total"}{$lang} + $po_fuzzy{"total"}{$lang} + $po_untranslated{"total"}{$lang}; |
| 241 |
|
|
| 242 |
|
if ($po_total{'total'} > 0) { |
| 243 |
|
$percent_po_t{'total'}{$lang} = int ($po_translated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
| 244 |
|
$percent_po_f{'total'}{$lang} = int ($po_fuzzy{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
| 245 |
|
$percent_po_u{'total'}{$lang} = int ($po_untranslated{'total'}{$lang}/$po_total{'total'} * 100 + .5); |
| 246 |
|
} else { |
| 247 |
|
$percent_po_t{'total'}{$lang} = 0; |
| 248 |
|
$percent_po_f{'total'}{$lang} = 0; |
| 249 |
|
$percent_po_u{'total'}{$lang} = 0; |
| 250 |
|
} |
| 251 |
|
} |
| 252 |
|
print "done.\n" if ($config{'verbose'}); |
| 253 |
|
|
| 254 |
# =============== Create HTML files =============== |
# =============== Create HTML files =============== |
| 255 |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
| 256 |
|
|
| 257 |
@sorted_english = sort (split (/ /, $wmlfiles{'english'})); |
my @filenames = sort keys %files; |
| 258 |
|
my $nfiles = scalar @filenames; |
| 259 |
|
|
| 260 |
print "Creating files: " if ($config{'verbose'}); |
print "Creating files: " if ($config{'verbose'}); |
|
my @search_in = (); |
|
|
if ($opt_l) { |
|
|
push @search_in, 'english'; |
|
|
push @search_in, $opt_l; |
|
|
} else { |
|
|
@search_in = sort keys %langs; |
|
|
} |
|
| 261 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 262 |
$l = $langs{$lang}; |
$l = $langs{$lang}; |
| 263 |
print "$l.html " if ($config{'verbose'}); |
print "$l.html " if ($config{'verbose'}); |
| 265 |
|
|
| 266 |
$t_body = $u_body = $o_body = ""; |
$t_body = $u_body = $o_body = ""; |
| 267 |
|
|
| 268 |
foreach $file (@sorted_english) { |
# get stats about files |
| 269 |
next if ($file eq ""); |
foreach $file (@filenames) { |
| 270 |
|
next if ($file eq ""); |
| 271 |
# Translated pages |
# Translated pages |
| 272 |
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
| 273 |
if ($file =~ /devel\/wnpp\/wnpp\.wml/) { |
$translated{$lang}++; |
| 274 |
$t_body .= sprintf "%s<br>\n", $file; |
$orig = $original{"$lang/$file"} || "english"; |
|
} else { |
|
|
$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file; |
|
|
} |
|
|
$translated{$lang}++; |
|
|
next if ($lang eq "english"); |
|
| 275 |
# Outdated translations |
# Outdated translations |
| 276 |
$msg = check_translation ($version{"$lang/$file"}, $version{"english/$file"}, "$lang/$file"); |
$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file"); |
| 277 |
if (length ($msg)) { |
if (length ($msg)) { |
| 278 |
$o_body .= "<tr>"; |
$o_body .= "<tr>"; |
| 279 |
if ($file =~ /devel\/wnpp\/wnpp\.wml/) { |
if ($file eq "devel/wnpp/wnpp") { |
| 280 |
$o_body .= sprintf "<td>%s</td>", $file; |
$o_body .= sprintf "<td>%s</td>", $file; |
| 281 |
} else { |
} else { |
| 282 |
$o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $file, $l, $file; |
$o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $file, $l, $file; |
| 283 |
} |
} |
| 284 |
$o_body .= sprintf "<td>%s</td>", $version{"$lang/$file"}; |
$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"}; |
| 285 |
$o_body .= sprintf "<td>%s</td>", $version{"english/$file"}; |
$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"}; |
| 286 |
$o_body .= sprintf "<td>%s</td>", $msg; |
$o_body .= sprintf "<td>%s</td>", $msg; |
| 287 |
$o_body .= sprintf "<td> <a href=\"http://cvs.debian.org/webwml/english/%s.wml.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\">%s -> %s</a></td>", $file, $version{"$lang/$file"}, $version{"english/$file"}, $config{'diff_type'}, $version{"$lang/$file"}, $version{"english/$file"}; |
$o_body .= sprintf "<td> <a href=\"http://cvs.debian.org/webwml/$orig/%s.wml.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"}; |
| 288 |
|
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
| 289 |
$o_body .= "</tr>\n"; |
$o_body .= "</tr>\n"; |
| 290 |
$outdated{$lang}++; |
$outdated{$lang}++; |
| 291 |
|
# Up-to-date translations |
| 292 |
|
} else { |
| 293 |
|
if ($file eq "devel/wnpp/wnpp") { |
| 294 |
|
$t_body .= sprintf "%s<br>\n", $file; |
| 295 |
|
} else { |
| 296 |
|
$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file; |
| 297 |
|
} |
| 298 |
} |
} |
| 299 |
} |
} |
| 300 |
# Untranslated pages |
# Untranslated pages |
| 301 |
else { |
else { |
| 302 |
if ($file =~ /devel\/wnpp\/wnpp\.wml/) { |
if ($file eq "devel/wnpp/wnpp") { |
| 303 |
$u_body .= sprintf "%s<br>\n", $file; |
$u_body .= sprintf "%s<br>\n", $file; |
| 304 |
} else { |
} else { |
| 305 |
$u_body .= sprintf "<a href=\"/%s\">%s</a><br>\n", $file, $file; |
$u_body .= sprintf "<a href=\"/%s\">%s</a><br>\n", $file, $file; |
| 307 |
$untranslated{$lang}++; |
$untranslated{$lang}++; |
| 308 |
} |
} |
| 309 |
} |
} |
| 310 |
|
|
| 311 |
|
|
| 312 |
# this is where we discard the files that the translation directory contains |
# this is where we discard the files that the translation directory contains |
| 313 |
# but which don't exist in the English directory |
# but which don't exist in the English directory |
| 314 |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
| 315 |
$wml{$lang} = $translated{$lang}; |
$wml{$lang} = $translated{$lang}; |
| 316 |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
| 317 |
|
|
| 318 |
$percent_a{$lang} = $wml{$lang}/$wml{english} * 100; |
$percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5); |
| 319 |
$percent_t{$lang} = $translated{$lang}/$wml{english} * 100; |
$percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5); |
| 320 |
$percent_o{$lang} = $outdated{$lang}/$wml{english} * 100; |
$percent_o{$lang} = 100 - $percent_t{$lang}; |
| 321 |
$percent_u{$lang} = $untranslated{$lang}/$wml{english} * 100; |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
| 322 |
|
|
| 323 |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
| 324 |
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; |
| 325 |
|
|
| 326 |
$color = get_color ($percent_a{$lang}); |
$color = get_color ($percent_a{$lang}); |
| 327 |
|
|
| 328 |
printf HTML "<table width=100%% cellpadding=2 cellspacing=0 bgcolor=%s>\n", $color; |
print HTML "<a name=\"top\"></a>\n"; |
| 329 |
|
printf HTML "<table width=\"100%%\" cellpadding=2 cellspacing=0 bgcolor=\"%s\">\n", $color; |
| 330 |
|
|
| 331 |
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; |
| 332 |
|
|
| 333 |
print HTML "<tr>\n"; |
print HTML "<tr>\n"; |
| 334 |
printf HTML "<td align=center width=25%%><b>%d files (%d%%) translated</b></td>", $wml{$lang}, $percent_a{$lang}; |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) translated</b></td>", $wml{$lang}, $percent_a{$lang}; |
| 335 |
printf HTML "<td align=center width=25%%><b>%d files (%d%%) up to date</b></td>", $translated{$lang}, $percent_t{$lang}; |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) up to date</b></td>", $translated{$lang}, $percent_t{$lang}; |
| 336 |
printf HTML "<td align=center width=25%%><b>%d files (%d%%) outdated</b></td>", $outdated{$lang}, $percent_o{$lang}; |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) outdated</b></td>", $outdated{$lang}, $percent_o{$lang}; |
| 337 |
printf HTML "<td align=center width=25%%><b>%d files (%d%%) not translated</b></td>", $untranslated{$lang}, $percent_u{$lang}; |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) not translated</b></td>", $untranslated{$lang}, $percent_u{$lang}; |
| 338 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 339 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 340 |
|
|
| 341 |
print HTML "<p><a href=\"./\">Index</a><p>\n"; |
# Make the table of content |
| 342 |
print HTML "<p><a href=\"../\">Working on the website</a><p>\n"; |
print HTML "<h3>Table of Contents</h3>\n"; |
| 343 |
|
print HTML "<p><a href=\"./\">Back to index of languages</a></p>\n"; |
| 344 |
|
print HTML "<br /><a href=\"../\">Working on the website</a>\n"; |
| 345 |
if ($o_body) { |
if ($o_body) { |
| 346 |
print HTML "<h3>Outdated translations:</h3>"; |
print HTML "<br /><a href=\"#outdated\">Outdated translations</a>\n"; |
| 347 |
|
} |
| 348 |
|
if ($u_body) { |
| 349 |
|
print HTML "<br /><a href=\"#untranslated\">Pages not translated</a>\n"; |
| 350 |
|
} |
| 351 |
|
if ($t_body) { |
| 352 |
|
print HTML "<br /><a href=\"#uptodate\">Translations up to date</a>\n"; |
| 353 |
|
} |
| 354 |
|
if ($lang ne 'english') { |
| 355 |
|
print HTML "<br /><a href=\"#gettext\">Translations of templates (gettext files)</a>\n"; |
| 356 |
|
} |
| 357 |
|
print HTML "</p>\n"; |
| 358 |
|
|
| 359 |
|
# outputs the content |
| 360 |
|
if ($o_body) { |
| 361 |
|
print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n"; |
| 362 |
print HTML "<table border=0 cellpadding=1 cellspacing=1>\n"; |
print HTML "<table border=0 cellpadding=1 cellspacing=1>\n"; |
| 363 |
print HTML "<tr><th>File</th><th>Translated</th><th>English</th><th>Comment</th>"; |
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
| 364 |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
| 365 |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
| 366 |
else { print HTML "<th>Diff</th>"; } |
else { print HTML "<th>Diff</th>"; } |
| 367 |
|
print HTML "<th>Maintainer</th>"; |
| 368 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 369 |
print HTML $o_body; |
print HTML $o_body; |
| 370 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 371 |
} |
} |
| 372 |
if ($u_body) { |
if ($u_body) { |
| 373 |
print HTML "<h3>Pages not translated:</h3>"; |
print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n"; |
| 374 |
print HTML $u_body; |
print HTML $u_body; |
| 375 |
} |
} |
| 376 |
if ($t_body) { |
if ($t_body) { |
| 377 |
print HTML "<h3>Translations up to date:</h3>"; |
print HTML "<h3><a name='uptodate'>Translations up to date</a>: <a href='#top'>(top)</a></h3>\n"; |
| 378 |
print HTML $t_body; |
print HTML $t_body; |
| 379 |
} |
} |
| 380 |
|
# outputs the gettext stats |
| 381 |
|
if ($lang ne 'english') { |
| 382 |
|
print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n"; |
| 383 |
|
# print HTML $border_head; |
| 384 |
|
print HTML "<table width=\"100%\" border=0>\n"; |
| 385 |
|
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
| 386 |
|
$l = $langs{$lang}; |
| 387 |
|
$l = "zh-cn" if ($l eq "zh"); # kludge |
| 388 |
|
|
| 389 |
|
foreach my $domain (sort keys %po_total) { |
| 390 |
|
next if $domain eq 'total'; |
| 391 |
|
print HTML "<tr>"; |
| 392 |
|
|
| 393 |
|
$color_t = get_color ($percent_po_t{$domain}{$lang}); |
| 394 |
|
$color_f = get_color (100 - $percent_po_f{$domain}{$lang}); |
| 395 |
|
$color_u = get_color (100 - $percent_po_u{$domain}{$lang}); |
| 396 |
|
|
| 397 |
|
print HTML "<td>$domain.$langs{$lang}.po</td>"; |
| 398 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang}; |
| 399 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang}; |
| 400 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{$domain}{$lang}, $percent_po_u{$domain}{$lang}; |
| 401 |
|
printf HTML "<td align=right>%d</td>", $po_total{$domain}; |
| 402 |
|
print HTML "</tr>\n"; |
| 403 |
|
} |
| 404 |
|
print HTML "<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><th>Total:</th>"; |
| 405 |
|
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 406 |
|
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 407 |
|
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 408 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
| 409 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
| 410 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 411 |
|
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
| 412 |
|
print HTML "</tr>\n"; |
| 413 |
|
} |
| 414 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 415 |
|
|
| 416 |
|
# outputs footer |
| 417 |
print HTML "<hr><address>Compiled at $date</address>\n"; |
print HTML "<hr><address>Compiled at $date</address>\n"; |
| 418 |
print HTML "</body></html>"; |
print HTML "</body></html>"; |
| 419 |
close (HTML); |
close (HTML); |
| 427 |
open (HTML, ">$config{'htmldir'}/index.html") |
open (HTML, ">$config{'htmldir'}/index.html") |
| 428 |
|| die "Can't open $config{'htmldir'}/index.html"; |
|| die "Can't open $config{'htmldir'}/index.html"; |
| 429 |
|
|
| 430 |
printf HTML "<html>\n<head><title>%s</title></head>\n<body bgcolor=#ffffff>\n", $config{'title'}; |
printf HTML "<html>\n<head><title>%s</title></head>\n<body bgcolor=\"#ffffff\">\n", $config{'title'}; |
| 431 |
printf HTML "<h1 align=center>%s</h1>\n", $config{'title'}; |
printf HTML "<h1 align=\"center\">%s</h1>\n", $config{'title'}; |
| 432 |
|
|
| 433 |
|
print HTML "<h2>Translated web pages</h2>\n"; |
| 434 |
|
printf HTML "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
| 435 |
|
|
| 436 |
print HTML $border_head; |
print HTML $border_head; |
| 437 |
print HTML "<table width=100% border=0 bgcolor=\"#cdc9c9\">\n"; |
print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 438 |
print HTML "<tr><th>Language</th><th>Translations</th><th>Up to date</th><th>Outdated</th><th>Not translated</th></tr>\n"; |
print HTML "<tr><th>Language</th><th>Translations</th><th>Up to date</th><th>Outdated</th><th>Not translated</th></tr>\n"; |
| 439 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 440 |
$l = $langs{$lang}; |
$l = $langs{$lang}; |
| 442 |
|
|
| 443 |
$color_a = get_color ($percent_a{$lang}); |
$color_a = get_color ($percent_a{$lang}); |
| 444 |
$color_t = get_color ($percent_t{$lang}); |
$color_t = get_color ($percent_t{$lang}); |
| 445 |
$color_o = get_color ($percent_o{$lang}); |
$color_o = get_color (100 - $percent_o{$lang}); |
| 446 |
$color_u = get_color ($percent_u{$lang}); |
$color_u = get_color (100 - $percent_u{$lang}); |
| 447 |
|
|
| 448 |
print HTML "<tr>"; |
print HTML "<tr>"; |
| 449 |
printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, ucfirst $lang, $l; |
printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, ucfirst $lang, $l; |
| 450 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang}; |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang}; |
| 451 |
if ($l ne "en") { |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang}; |
| 452 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang}; |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang}; |
| 453 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang}; |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang}; |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang}; |
|
|
} else { |
|
|
print HTML "<td bgcolor=\"#00FF00\" align=right>-</td><td bgcolor=\"#00FF00\" align=right>-</td><td bgcolor=\"#FF0000\" align=right>-</td>"; |
|
|
} |
|
| 454 |
print HTML "</tr>\n", |
print HTML "</tr>\n", |
| 455 |
} |
} |
| 456 |
|
print HTML "</table>\n"; |
|
print HTML "</tr></table>"; |
|
| 457 |
print HTML $border_foot; |
print HTML $border_foot; |
| 458 |
|
|
| 459 |
|
print HTML "<h2>Translated templates (gettext files)</h2>\n"; |
| 460 |
|
printf HTML "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
| 461 |
|
print HTML $border_head; |
| 462 |
|
print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 463 |
|
print HTML "<tr><th>Language</th><th>Up to date</th><th>Fuzzy</th><th>Not translated</th></tr>\n"; |
| 464 |
|
foreach $lang (@search_in) { |
| 465 |
|
next if $lang eq 'english'; |
| 466 |
|
$l = $langs{$lang}; |
| 467 |
|
$l = "zh-cn" if ($l eq "zh"); # kludge |
| 468 |
|
|
| 469 |
|
print HTML "<tr>"; |
| 470 |
|
printf HTML "<td><a href=\"%s.html#gettext\">%s</a> (%s)</td>", $l, ucfirst $lang, $l; |
| 471 |
|
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 472 |
|
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 473 |
|
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 474 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
| 475 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
| 476 |
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 477 |
|
print HTML "</tr>\n"; |
| 478 |
|
} |
| 479 |
|
|
| 480 |
print HTML "</table>\n"; |
print HTML "</table>\n"; |
| 481 |
print HTML "<p><hr noshade size=1 width=100%>\n"; |
print HTML $border_foot; |
| 482 |
|
|
| 483 |
|
print HTML "<p><hr noshade size=1 width=\"100%\">\n"; |
| 484 |
print HTML "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n"; |
print HTML "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n"; |
| 485 |
print HTML "</body></html>\n"; |
print HTML "</body></html>\n"; |
| 486 |
close (HTML); |
close (HTML); |