| 15 |
|
|
| 16 |
# You should have received a copy of the GNU General Public License |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program; if not, write to the Free Software |
# along with this program; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 |
|
|
| 20 |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
| 21 |
use Getopt::Std; |
use Getopt::Std; |
| 31 |
|
|
| 32 |
$opt_h = "/org/www.debian.org/www/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|src)"; |
| 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:') || die; |
$opt_b = ""; # Base URL, if not debian.org |
| 40 |
|
$opt_f = undef; # File lines: "1299999 /doc/index\n" |
| 41 |
|
getopts('h:w:b:p:t:vd:l:f:') || die; |
| 42 |
# Replace filename globbing by Perl regexps |
# Replace filename globbing by Perl regexps |
| 43 |
$opt_p =~ s/\./\\./g; |
$opt_p =~ s/\./\\./g; |
| 44 |
$opt_p =~ s/\?/./g; |
$opt_p =~ s/\?/./g; |
| 51 |
'title' => $opt_t, |
'title' => $opt_t, |
| 52 |
'verbose' => $opt_v, |
'verbose' => $opt_v, |
| 53 |
'difftype'=> $opt_d, |
'difftype'=> $opt_d, |
| 54 |
|
'hit_file'=> $opt_f, |
| 55 |
); |
); |
| 56 |
|
|
| 57 |
my $l = Webwml::Langs->new($opt_w); |
my $l = Webwml::Langs->new($opt_w); |
| 80 |
$max_versions = 5; |
$max_versions = 5; |
| 81 |
$min_versions = 1; |
$min_versions = 1; |
| 82 |
|
|
|
$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>"; |
|
|
|
|
| 83 |
|
|
| 84 |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
$date = strftime "%a %b %e %H:%M:%S %Y %z", localtime; |
| 85 |
|
|
| 87 |
my %transversion; |
my %transversion; |
| 88 |
my %version; |
my %version; |
| 89 |
my %files; |
my %files; |
| 90 |
|
my %sizes; |
| 91 |
|
|
| 92 |
# Count wml files in given directory |
# Count wml files in given directory |
| 93 |
# |
# |
| 97 |
my $dir = "$config{'wmldir'}/$lang"; |
my $dir = "$config{'wmldir'}/$lang"; |
| 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 $size = 0; |
| 101 |
my $is_english = ($lang eq "english")?1:0; |
my $is_english = ($lang eq "english")?1:0; |
| 102 |
my ( $file, $v ); |
my ( $file, $v ); |
| 103 |
my @listfiles; |
my @listfiles; |
| 104 |
|
|
| 105 |
print "$lang " if ($config{verbose}); |
print "$lang " if ($config{verbose}); |
| 106 |
die "$0: can't find $dir!\n" if (! -d "$dir"); |
if (! -d "$dir") { |
| 107 |
|
print "$0: can't find $dir! Skipping ...\n"; |
| 108 |
|
return; |
| 109 |
|
} |
| 110 |
if ($is_english) { |
if ($is_english) { |
| 111 |
@listfiles = @{$cvs->files()}; |
@listfiles = @{$cvs->files()}; |
| 112 |
} else { |
} else { |
| 117 |
foreach my $f (@listfiles) { |
foreach my $f (@listfiles) { |
| 118 |
$file = substr ($f, $cutfrom); |
$file = substr ($f, $cutfrom); |
| 119 |
next if $transignore->is_global($file); |
next if $transignore->is_global($file); |
|
$file =~ s/\.wml$//; |
|
| 120 |
$files{$file} = 1; |
$files{$file} = 1; |
| 121 |
$wmlfiles{$lang} .= " " . $file; |
$wmlfiles{$lang} .= " " . $file; |
| 122 |
my $transcheck = Webwml::TransCheck->new("$dir/$file.wml"); |
my $transcheck = Webwml::TransCheck->new("$dir/$file"); |
| 123 |
if ($transcheck->revision()) { |
if ($transcheck->revision()) { |
| 124 |
$transversion{"$lang/$file"} = $transcheck->revision(); |
$transversion{"$lang/$file"} = $transcheck->revision(); |
| 125 |
$original{"$lang/$file"} ||= $transcheck->original(); |
$original{"$lang/$file"} ||= $transcheck->original(); |
| 129 |
} else { |
} else { |
| 130 |
$version{"$lang/$file"} = $altcvs->revision($f); |
$version{"$lang/$file"} = $altcvs->revision($f); |
| 131 |
if (!$transcheck->revision()) { |
if (!$transcheck->revision()) { |
| 132 |
$original{"english/$file"} = $lang; |
$transcheckenglish = Webwml::TransCheck->new("english/$file"); |
| 133 |
$transversion{"english/$file"} ||= "1.1"; |
if (!$transcheckenglish->revision() and (-e "english/$file")) { |
| 134 |
|
$transversion{"$lang/$file"} = "1.1"; |
| 135 |
|
$original{"$lang/$file"} = "english"; |
| 136 |
|
} else { |
| 137 |
|
$original{"english/$file"} = $lang; |
| 138 |
|
$transversion{"english/$file"} ||= "1.1"; |
| 139 |
|
} |
| 140 |
} |
} |
| 141 |
} |
} |
| 142 |
if ($transcheck->maintainer()) { |
if ($transcheck->maintainer()) { |
| 143 |
$maintainer{"$lang/$file"} = $transcheck->maintainer(); |
$maintainer{"$lang/$file"} = $transcheck->maintainer(); |
| 144 |
} |
} |
| 145 |
$count++; |
$count++; |
| 146 |
|
$sizes{$file} = (stat "".($original{"english/$file"}||"english")."/".$file)[7]; |
| 147 |
|
$size += $sizes{$file}; |
| 148 |
} |
} |
| 149 |
$wmlfiles{$lang} .= " "; |
$wmlfiles{$lang} .= " "; |
| 150 |
$wml{$lang} = $count; |
$wml{$lang} = $count; |
| 151 |
|
$wml_s{$lang} = $size; |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
sub get_color |
sub get_color |
| 187 |
|
|
| 188 |
if ( $major_number != $major_translated_number ) { |
if ( $major_number != $major_translated_number ) { |
| 189 |
return "This translation is too out of date"; |
return "This translation is too out of date"; |
| 190 |
|
} elsif ( $last_number - $last_translated_number < 0 ) { |
| 191 |
|
return "Wrong translation version"; |
| 192 |
} elsif ( $last_number - $last_translated_number >= $max_versions ) { |
} elsif ( $last_number - $last_translated_number >= $max_versions ) { |
| 193 |
return "This translation is too out of date"; |
return "This translation is too out of date"; |
| 194 |
} elsif ( $last_number - $last_translated_number >= $min_versions ) { |
} elsif ( $last_number - $last_translated_number >= $min_versions ) { |
| 195 |
return "The original is newer than this translation"; |
return "The original is newer than this translation"; |
| 196 |
} |
} |
| 197 |
} elsif ( !$version && $transversion) { |
} elsif ( !$version && $translation) { |
| 198 |
return "The original no longer exists"; |
return "The original no longer exists"; |
| 199 |
} |
} |
| 200 |
return ""; |
return ""; |
| 224 |
my ( %percent_po_t, %percent_po_u, %percent_po_f ); |
my ( %percent_po_t, %percent_po_u, %percent_po_f ); |
| 225 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 226 |
next if $lang eq 'english'; |
next if $lang eq 'english'; |
|
$l = $langs{$lang}; |
|
| 227 |
$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; |
| 228 |
|
$percent_po_t{'total'}{$lang} = 0; |
| 229 |
|
$percent_po_f{'total'}{$lang} = 0; |
| 230 |
|
$percent_po_u{'total'}{$lang} = 100; |
| 231 |
|
if (! -d "$opt_w/$lang/po") { |
| 232 |
|
print "$0: can't find $opt_w/$lang/po! Skipping ...\n"; |
| 233 |
|
next; |
| 234 |
|
} |
| 235 |
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,; |
| 236 |
foreach $line (@status) { |
foreach $line (@status) { |
| 237 |
chomp $line; |
chomp $line; |
| 241 |
$po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0"); |
$po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0"); |
| 242 |
|
|
| 243 |
$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}; |
| 244 |
|
|
| 245 |
$po_translated{"total"}{$lang} += $po_translated{$domain}{$lang}; |
$po_translated{"total"}{$lang} += $po_translated{$domain}{$lang}; |
| 246 |
$po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang}; |
$po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang}; |
| 247 |
$po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang}; |
$po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang}; |
| 248 |
|
|
| 249 |
if ($po_total{$domain} > 0) { |
if ($po_total{$domain} > 0) { |
| 250 |
$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); |
| 251 |
$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); |
| 253 |
} else { |
} else { |
| 254 |
$percent_po_t{$domain}{$lang} = 0; |
$percent_po_t{$domain}{$lang} = 0; |
| 255 |
$percent_po_f{$domain}{$lang} = 0; |
$percent_po_f{$domain}{$lang} = 0; |
| 256 |
$percent_po_u{$domain}{$lang} = 0; |
$percent_po_u{$domain}{$lang} = 0; # or 100 if po/ doesn't exist |
| 257 |
} |
} |
| 258 |
} |
} |
| 259 |
$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 |
|
|
| 261 |
if ($po_total{'total'} > 0) { |
if ($po_total{'total'} > 0) { |
| 262 |
$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); |
| 263 |
$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); |
| 264 |
$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; |
|
| 265 |
} |
} |
| 266 |
} |
} |
| 267 |
print "done.\n" if ($config{'verbose'}); |
print "done.\n" if ($config{'verbose'}); |
| 269 |
# =============== Create HTML files =============== |
# =============== Create HTML files =============== |
| 270 |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'}); |
| 271 |
|
|
| 272 |
my @filenames = sort keys %files; |
# Read website hit statistics, if available |
| 273 |
|
my %hits; |
| 274 |
|
my $file_sorter; |
| 275 |
|
if ($config{'hit_file'}) { |
| 276 |
|
open(HITS, $config{'hit_file'}) or die sprintf("Opening hit file [%s] failed: $!", $config{'hit_file'}); |
| 277 |
|
printf "Reading hit file [%s]\n", $config{'hit_file'} if ($config{'verbose'}); |
| 278 |
|
foreach my $hit_line (<HITS>) { |
| 279 |
|
chomp $hit_line; |
| 280 |
|
$hit_line =~ /^\s*(\d+)\s+(.*)/ or warn sprintf("unrecognized hit file [%s] line [%s]", $config{'hit_file'}, $hit_line); |
| 281 |
|
my ($count, $url) = ($1, $2); |
| 282 |
|
last if $count < 3; # URLS with 2 or 1 hits are most likely mistakes; let's not waste RAM on them |
| 283 |
|
$hits{substr($url, 1)} = $count; |
| 284 |
|
} |
| 285 |
|
close(HITS) or die sprintf("Closing hit file [%s] failed: $!", $config{'hit_file'}); |
| 286 |
|
$file_sorter = sub($$) { |
| 287 |
|
my ($a, $b) = @_; |
| 288 |
|
$a =~ s/\.wml$//o; |
| 289 |
|
$b =~ s/\.wml$//o; |
| 290 |
|
$hits{$b} <=> $hits{$a} |
| 291 |
|
}; |
| 292 |
|
} else { |
| 293 |
|
print "No hit file specified. Tables will be sorted alphabetically.\n" if ($config{'verbose'}); |
| 294 |
|
$file_sorter = sub($$) { $_[0] cmp $_[1] }; |
| 295 |
|
} |
| 296 |
|
|
| 297 |
|
my @filenames = sort $file_sorter keys %files; |
| 298 |
my $nfiles = scalar @filenames; |
my $nfiles = scalar @filenames; |
| 299 |
|
$nsize += $sizes{$_} foreach (@filenames); |
| 300 |
|
|
| 301 |
|
my $firstdifftype; |
| 302 |
|
my $seconddifftype; |
| 303 |
|
if ($config{'difftype'} eq 'u') { |
| 304 |
|
$firstdifftype = 'u'; |
| 305 |
|
$seconddifftype = 'h'; |
| 306 |
|
} else { |
| 307 |
|
$firstdifftype = 'h'; |
| 308 |
|
$seconddifftype = 'u'; |
| 309 |
|
} |
| 310 |
|
|
| 311 |
print "Creating files: " if ($config{'verbose'}); |
print "Creating files: " if ($config{'verbose'}); |
| 312 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 313 |
$l = $langs{$lang}; |
my @processed_langs = ($langs{$lang}); |
| 314 |
print "$l.html " if ($config{'verbose'}); |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 315 |
$l = "zh-cn" if ($l eq "zh"); # kludge |
foreach $l (@processed_langs) { |
| 316 |
|
print "$l.html " if ($config{'verbose'}); |
| 317 |
$t_body = $u_body = $o_body = ""; |
|
| 318 |
|
$charset{$lang}; |
| 319 |
# get stats about files |
open (wmlrc,"$opt_w/$lang/.wmlrc") ; |
| 320 |
foreach $file (@filenames) { |
while (<wmlrc>) { |
| 321 |
next if ($file eq ""); |
if ( /^-D CHARSET=(.*)$/ ) { |
| 322 |
# Translated pages |
$charset{$lang} = $1; |
|
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
|
|
$translated{$lang}++; |
|
|
$orig = $original{"$lang/$file"} || "english"; |
|
|
# Outdated translations |
|
|
$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file"); |
|
|
if (length ($msg)) { |
|
|
$o_body .= "<tr>"; |
|
|
if ($file eq "devel/wnpp/wnpp") { |
|
|
$o_body .= sprintf "<td>%s</td>", $file; |
|
|
} else { |
|
|
$o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $file, $l, $file; |
|
|
} |
|
|
$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"}; |
|
|
$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"}; |
|
|
$o_body .= sprintf "<td>%s</td>", $msg; |
|
|
$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"}; |
|
|
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
|
|
$o_body .= "</tr>\n"; |
|
|
$outdated{$lang}++; |
|
|
# Up-to-date translations |
|
|
} else { |
|
|
if ($file eq "devel/wnpp/wnpp") { |
|
|
$t_body .= sprintf "%s<br>\n", $file; |
|
|
} else { |
|
|
$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file; |
|
| 323 |
} |
} |
| 324 |
} |
} |
| 325 |
} |
close wmlrc ; |
| 326 |
# Untranslated pages |
|
| 327 |
else { |
$t_body = $u_body = $ui_body = $un_body = $uu_body = $o_body = ""; |
| 328 |
if ($file eq "devel/wnpp/wnpp") { |
$translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0; |
| 329 |
$u_body .= sprintf "%s<br>\n", $file; |
|
| 330 |
|
# get stats about files |
| 331 |
|
foreach $file (@filenames) { |
| 332 |
|
next if ($file eq ""); |
| 333 |
|
(my $base = $file) =~ s/\.wml$//; |
| 334 |
|
my $hits = exists $hits{$base} ? $hits{$base}.' hits' : 'hit count N/A'; |
| 335 |
|
# Translated pages |
| 336 |
|
if (index ($wmlfiles{$lang}, " $file ") >= 0) { |
| 337 |
|
$translated{$lang}++; |
| 338 |
|
$translated_s{$lang} += $sizes{$file}; |
| 339 |
|
$orig = $original{"$lang/$file"} || "english"; |
| 340 |
|
# Outdated translations |
| 341 |
|
$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file"); |
| 342 |
|
if (length ($msg)) { |
| 343 |
|
$o_body .= "<tr>"; |
| 344 |
|
if (($file !~ /\.wml$/) |
| 345 |
|
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 346 |
|
$o_body .= sprintf "<td>%s</td>", $file; |
| 347 |
|
} else { |
| 348 |
|
$o_body .= sprintf "<td><a title=\"%s\" href=\"$opt_b/%s.%s.html\">%s</a></td>", $hits, $base, $l, $base; |
| 349 |
|
} |
| 350 |
|
$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"}; |
| 351 |
|
$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"}; |
| 352 |
|
$o_body .= sprintf "<td>%s</td>", $msg; |
| 353 |
|
if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") { |
| 354 |
|
$o_body .= "<td></td><td></td>"; |
| 355 |
|
} else { |
| 356 |
|
$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>", |
| 357 |
|
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 358 |
|
$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>", |
| 359 |
|
$file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; |
| 360 |
|
} |
| 361 |
|
$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"}; |
| 362 |
|
$o_body .= sprintf "<td><a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/%s/%s?root=webwml\&view=markup\&revision=%s\">[V]</a>\ ", $lang, $file, $version{"$orig/$file"}; |
| 363 |
|
$o_body .= sprintf "<a href=\"http://alioth.debian.org/scm/viewvc.php/*checkout*/webwml/%s/%s?root=webwml\&revision=%s\">[F]</a></td>", $lang, $file, $version{"$orig/$file"}; |
| 364 |
|
$o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || ""; |
| 365 |
|
$o_body .= "</tr>\n"; |
| 366 |
|
$outdated{$lang}++; |
| 367 |
|
$outdated_s{$lang} += $sizes{$file}; |
| 368 |
|
# Up-to-date translations |
| 369 |
|
} else { |
| 370 |
|
if (($file !~ /\.wml$/) |
| 371 |
|
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 372 |
|
$t_body .= sprintf "<li>%s</li>\n", $file; |
| 373 |
|
} else { |
| 374 |
|
$t_body .= sprintf "<li><a title=\"%s\" href=\"$opt_b/%s.%s.html\">%s</a></li>\n", $hits, $base, $l, $base; |
| 375 |
|
} |
| 376 |
|
} |
| 377 |
|
} |
| 378 |
|
# Untranslated pages |
| 379 |
|
else { |
| 380 |
|
my $u_tmp; |
| 381 |
|
if (($file !~ /\.wml$/) |
| 382 |
|
|| ($file eq "devel/wnpp/wnpp.wml")) { |
| 383 |
|
$u_tmp = sprintf "<tr><td>%s</td><td> </td></tr>\n", $file; |
| 384 |
|
} else { |
| 385 |
|
$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; |
| 386 |
|
} |
| 387 |
|
if (($file =~ /international\//) && |
| 388 |
|
(($file !~ /international\/index.wml$/) || |
| 389 |
|
($file !~ /international\/l10n\//))) { |
| 390 |
|
$ui_body .=$u_tmp; |
| 391 |
|
} elsif ((($file =~ /(News|events|security|vote)\/[0-9]{4}\//) && |
| 392 |
|
($file !~ /index.wml$/)) || |
| 393 |
|
($file =~ /(News\/weekly\/[0-9]{4}\/|security\/undated)/)) { |
| 394 |
|
$un_body .= $u_tmp; |
| 395 |
|
} elsif (($file =~ /(consultants|users\/(com|edu|gov|org))\//) && |
| 396 |
|
($file !~ /index.wml$/)) { |
| 397 |
|
$uu_body .=$u_tmp; |
| 398 |
} else { |
} else { |
| 399 |
$u_body .= sprintf "<a href=\"/%s\">%s</a><br>\n", $file, $file; |
$u_body .= $u_tmp; |
| 400 |
} |
} |
| 401 |
$untranslated{$lang}++; |
$untranslated{$lang}++; |
| 402 |
} |
$untranslated_s{$lang} += $sizes{$file}; |
| 403 |
} |
} |
| 404 |
|
} |
| 405 |
|
|
| 406 |
# this is where we discard the files that the translation directory contains |
|
| 407 |
# but which don't exist in the English directory |
# this is where we discard the files that the translation directory contains |
| 408 |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
# but which don't exist in the English directory |
| 409 |
$wml{$lang} = $translated{$lang}; |
# print "extra files: ".$wml{$lang}-$translated{$lang}."\n"; |
| 410 |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
$wml{$lang} = $translated{$lang}; |
| 411 |
|
$wml_s{$lang} = $translated_s{$lang}; |
| 412 |
$percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5); |
$translated{$lang} = $translated{$lang} - $outdated{$lang}; |
| 413 |
$percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5); |
$translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang}; |
| 414 |
$percent_o{$lang} = 100 - $percent_t{$lang}; |
|
| 415 |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
if ($nfiles > 0) { |
| 416 |
|
$percent_a{$lang} = $wml{$lang}/$nfiles * 100; |
| 417 |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
} else { |
| 418 |
printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang; |
$percent_a{$lang} = 0; |
| 419 |
|
} |
| 420 |
$color = get_color ($percent_a{$lang}); |
if ($nsize > 0) { |
| 421 |
|
$percent_as{$lang} = $wml_s{$lang}/$nsize * 100; |
| 422 |
print HTML "<a name=\"top\"></a>\n"; |
} else { |
| 423 |
printf HTML "<table width=\"100%%\" cellpadding=2 cellspacing=0 bgcolor=\"%s\">\n", $color; |
$percent_as{$lang} = 0; |
| 424 |
|
} |
| 425 |
printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang; |
if ($wml{$lang} > 0) { |
| 426 |
|
$percent_t{$lang} = $translated{$lang}/$wml{$lang} * 100; |
| 427 |
print HTML "<tr>\n"; |
} else { |
| 428 |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) translated</b></td>", $wml{$lang}, $percent_a{$lang}; |
$percent_t{$lang} = 0; |
| 429 |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) up to date</b></td>", $translated{$lang}, $percent_t{$lang}; |
} |
| 430 |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) outdated</b></td>", $outdated{$lang}, $percent_o{$lang}; |
if ($wml_s{$lang} > 0) { |
| 431 |
printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) not translated</b></td>", $untranslated{$lang}, $percent_u{$lang}; |
$percent_ts{$lang} = $translated_s{$lang}/$wml_s{$lang} * 100; |
| 432 |
print HTML "</tr>\n"; |
} else { |
| 433 |
print HTML "</table>\n"; |
$percent_ts{$lang} = 0; |
| 434 |
|
} |
| 435 |
# Make the table of content |
$percent_o{$lang} = 100 - $percent_t{$lang}; |
| 436 |
print HTML "<h3>Table of Contents</h3>\n"; |
$percent_os{$lang} = 100 - $percent_ts{$lang}; |
| 437 |
print HTML "<p><a href=\"./\">Back to index of languages</a></p>\n"; |
$percent_u{$lang} = 100 - $percent_a{$lang}; |
| 438 |
print HTML "<br /><a href=\"../\">Working on the website</a>\n"; |
$percent_us{$lang} = 100 - $percent_as{$lang}; |
| 439 |
if ($o_body) { |
|
| 440 |
print HTML "<br /><a href=\"#outdated\">Outdated translations</a>\n"; |
if (open (HTML, ">$config{'htmldir'}/$l.html")) { |
| 441 |
} |
printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"; |
| 442 |
if ($u_body) { |
# printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang; |
| 443 |
print HTML "<br /><a href=\"#untranslated\">Pages not translated</a>\n"; |
printf HTML "<html>\n<head>\n"; |
| 444 |
} |
printf HTML " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset{$lang}\">\n"; |
| 445 |
if ($t_body) { |
printf HTML " <title>%s: %s</title>\n", $config{'title'}, ucfirst $lang; |
| 446 |
print HTML "<br /><a href=\"#uptodate\">Translations up to date</a>\n"; |
print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
| 447 |
} |
print HTML "</head>\n<body>\n"; |
| 448 |
if ($lang ne 'english') { |
$color = get_color ($percent_a{$lang}); |
| 449 |
print HTML "<br /><a href=\"#gettext\">Translations of templates (gettext files)</a>\n"; |
|
| 450 |
} |
printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color; |
| 451 |
print HTML "</p>\n"; |
printf HTML "%s: %s</h1>\n", $config{'title'}, ucfirst $lang; |
| 452 |
|
printf HTML "<table summary=\"Translation Summary for $lang\" style=\"background-color: %s\; width: 100%\; font-weight: bold\; margin: 0\; text-align: center\;\">\n", $color; |
| 453 |
# outputs the content |
print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n"; |
| 454 |
if ($o_body) { |
# printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang; |
| 455 |
print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n"; |
|
| 456 |
print HTML "<table border=0 cellpadding=1 cellspacing=1>\n"; |
print HTML "<tr><th>Translated</th><th>Up-to-date</th><th>Outdated</th><th>Not translated</th></tr>\n<tr>"; |
| 457 |
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
printf HTML "<td>%d files (%.1f%%)</td>", $wml{$lang}, $percent_a{$lang}; |
| 458 |
if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; } |
printf HTML "<td>%d files (%.1f%%)</td>", $translated{$lang}, $percent_t{$lang}; |
| 459 |
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; } |
printf HTML "<td>%d files (%.1f%%)</td>", $outdated{$lang}, $percent_o{$lang}; |
| 460 |
else { print HTML "<th>Diff</th>"; } |
printf HTML "<td>%d files (%.1f%%)</td>", $untranslated{$lang}, $percent_u{$lang}; |
| 461 |
print HTML "<th>Maintainer</th>"; |
print HTML "</tr>\n"; |
| 462 |
print HTML "</tr>\n"; |
print HTML "<tr>\n"; |
| 463 |
print HTML $o_body; |
printf HTML "<td>%d bytes (%.1f%%)</td>", $wml_s{$lang}, $percent_as{$lang}; |
| 464 |
print HTML "</table>\n"; |
printf HTML "<td>%d bytes (%.1f%%)</td>", $translated_s{$lang}, $percent_ts{$lang}; |
| 465 |
} |
printf HTML "<td>%d bytes (%.1f%%)</td>", $outdated_s{$lang}, $percent_os{$lang}; |
| 466 |
if ($u_body) { |
printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang}; |
|
print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n"; |
|
|
print HTML $u_body; |
|
|
} |
|
|
if ($t_body) { |
|
|
print HTML "<h3><a name='uptodate'>Translations up to date</a>: <a href='#top'>(top)</a></h3>\n"; |
|
|
print HTML $t_body; |
|
|
} |
|
|
# outputs the gettext stats |
|
|
if ($lang ne 'english') { |
|
|
print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n"; |
|
|
# print HTML $border_head; |
|
|
print HTML "<table width=\"100%\" border=0>\n"; |
|
|
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
|
|
$l = $langs{$lang}; |
|
|
$l = "zh-cn" if ($l eq "zh"); # kludge |
|
|
|
|
|
foreach my $domain (sort keys %po_total) { |
|
|
next if $domain eq 'total'; |
|
|
print HTML "<tr>"; |
|
|
|
|
|
$color_t = get_color ($percent_po_t{$domain}{$lang}); |
|
|
$color_f = get_color (100 - $percent_po_f{$domain}{$lang}); |
|
|
$color_u = get_color (100 - $percent_po_u{$domain}{$lang}); |
|
|
|
|
|
print HTML "<td>$domain.$langs{$lang}.po</td>"; |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang}; |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang}; |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{$domain}{$lang}, $percent_po_u{$domain}{$lang}; |
|
|
printf HTML "<td align=right>%d</td>", $po_total{$domain}; |
|
|
print HTML "</tr>\n"; |
|
|
} |
|
|
print HTML "<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><th>Total:</th>"; |
|
|
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
|
|
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
|
|
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
|
|
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
|
|
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
|
| 467 |
print HTML "</tr>\n"; |
print HTML "</tr>\n"; |
| 468 |
} |
print HTML "</table>\n"; |
| 469 |
print HTML "</table>\n"; |
|
| 470 |
|
# Make the table of content |
| 471 |
# outputs footer |
print HTML "<h3>Table of Contents</h3>\n"; |
| 472 |
print HTML "<hr><address>Compiled at $date</address>\n"; |
print HTML "<ul>\n"; |
| 473 |
print HTML "</body></html>"; |
print HTML "<li><a href=\"./\">Back to index of languages</a></li>\n"; |
| 474 |
close (HTML); |
print HTML "<li><a href=\"../\">Working on the website</a></li>\n"; |
| 475 |
|
if ($o_body) { |
| 476 |
|
print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n"; |
| 477 |
|
} |
| 478 |
|
if (($u_body) || ($ui_body) || ($un_body) || ($uu_body)) { |
| 479 |
|
print HTML "<li>Untranslated\n"; |
| 480 |
|
print HTML "<ul>\n"; |
| 481 |
|
if ($u_body) { |
| 482 |
|
print HTML "<li><a href=\"#untranslated\">General pages</a></li>\n"; |
| 483 |
|
} |
| 484 |
|
if ($ui_body) { |
| 485 |
|
print HTML "<li><a href=\"#untranslated-l10n\">International pages</a></li>\n"; |
| 486 |
|
} |
| 487 |
|
if ($un_body) { |
| 488 |
|
print HTML "<li><a href=\"#untranslated-news\">News items</a></li>\n"; |
| 489 |
|
} |
| 490 |
|
if ($uu_body) { |
| 491 |
|
print HTML "<li><a href=\"#untranslated-user\">Consultant/user pages</a></li>\n"; |
| 492 |
|
} |
| 493 |
|
print HTML "</ul></li>\n"; |
| 494 |
|
} |
| 495 |
|
if ($t_body) { |
| 496 |
|
print HTML "<li><a href=\"#uptodate\">Translated pages (up-to-date)</a></li>\n"; |
| 497 |
|
} |
| 498 |
|
if ($lang ne 'english') { |
| 499 |
|
print HTML "<li><a href=\"#gettext\">Translation of templates (gettext files)</a></li>\n"; |
| 500 |
|
} |
| 501 |
|
print HTML "</ul>\n"; |
| 502 |
|
|
| 503 |
|
# outputs the content |
| 504 |
|
if ($o_body) { |
| 505 |
|
print HTML "<h3 id='outdated'>Outdated translations: <a href='#top'>(top)</a></h3>\n"; |
| 506 |
|
print HTML "<table summary=\"Outdated translations\" border=0 cellpadding=1 cellspacing=1>\n"; |
| 507 |
|
print HTML "<tr><th>File</th><th>Translated</th><th>Origin</th><th>Comment</th>"; |
| 508 |
|
if ($opt_d eq "u") { print HTML "<th>Unified diff</th><th>Colored diff</th>"; } |
| 509 |
|
elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th><th>Unified diff</th>"; } |
| 510 |
|
else { print HTML "<th>Diff</th>"; } |
| 511 |
|
print HTML "<th>Log</th>"; |
| 512 |
|
print HTML "<th>Translation</th>"; |
| 513 |
|
print HTML "<th>Maintainer</th>"; |
| 514 |
|
print HTML "</tr>\n"; |
| 515 |
|
print HTML $o_body; |
| 516 |
|
print HTML "</table>\n"; |
| 517 |
|
} |
| 518 |
|
if ($u_body) { |
| 519 |
|
print HTML "<h3 id='untranslated'>General pages not translated: <a href='#top'>(top)</a></h3>\n"; |
| 520 |
|
print HTML "<table summary=\"Untranslated general pages\">\n"; |
| 521 |
|
print HTML $u_body; |
| 522 |
|
print HTML "</table>\n"; |
| 523 |
|
} |
| 524 |
|
if ($ui_body) { |
| 525 |
|
print HTML "<h3 id='untranslated-l10n'>International pages not translated: <a href='#top'>(top)</a></h3>\n"; |
| 526 |
|
print HTML "<table summary=\"Untranslated international pages\">\n"; |
| 527 |
|
print HTML $ui_body; |
| 528 |
|
print HTML "</table>\n"; |
| 529 |
|
} |
| 530 |
|
if ($un_body) { |
| 531 |
|
print HTML "<h3 id='untranslated-news'>News items not translated: <a href='#top'>(top)</a></h3>\n"; |
| 532 |
|
print HTML "<table summary=\"Untranslated news items\">\n"; |
| 533 |
|
print HTML $un_body; |
| 534 |
|
print HTML "</table>\n"; |
| 535 |
|
} |
| 536 |
|
if ($uu_body) { |
| 537 |
|
print HTML "<h3 id='untranslated-user'>Consultant/user pages not translated: <a href='#top'>(top)</a></h3>\n"; |
| 538 |
|
print HTML "<table summary=\"Untranslated consultant/user pages\">\n"; |
| 539 |
|
print HTML $uu_body; |
| 540 |
|
print HTML "</table>\n"; |
| 541 |
|
} |
| 542 |
|
if ($t_body) { |
| 543 |
|
print HTML "<h3 id='uptodate'>Translated pages (up-to-date): <a href='#top'>(top)</a></h3>\n"; |
| 544 |
|
print HTML "<ul class=\"discless\">\n"; |
| 545 |
|
print HTML $t_body; |
| 546 |
|
print HTML "</ul>\n"; |
| 547 |
|
} |
| 548 |
|
# outputs the gettext stats |
| 549 |
|
if ($lang ne 'english') { |
| 550 |
|
print HTML "<h3 id='gettext'>Translation of templates (gettext files): <a href='#top'>(top)</a></h3>\n"; |
| 551 |
|
# print HTML $border_head; |
| 552 |
|
print HTML "<table summary=\"Gettext statistics\" width=\"100%\">\n"; |
| 553 |
|
print HTML "<tr><th>File</th><th>Up to date</th><th>Fuzzy</th><th>Untranslated</th><th>Total</th></tr>\n"; |
| 554 |
|
foreach my $domain (sort keys %po_total) { |
| 555 |
|
next if $domain eq 'total'; |
| 556 |
|
print HTML "<tr>"; |
| 557 |
|
|
| 558 |
|
$color_t = get_color ($percent_po_t{$domain}{$lang}); |
| 559 |
|
$color_f = get_color (100 - $percent_po_f{$domain}{$lang}); |
| 560 |
|
$color_u = get_color (100 - $percent_po_u{$domain}{$lang}); |
| 561 |
|
|
| 562 |
|
print HTML "<td>$domain.$langs{$lang}.po</td>"; |
| 563 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang}; |
| 564 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang}; |
| 565 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_u, $po_untranslated{$domain}{$lang}, $percent_po_u{$domain}{$lang}; |
| 566 |
|
printf HTML "<td align=right>%d</td>", $po_total{$domain}; |
| 567 |
|
print HTML "</tr>\n"; |
| 568 |
|
} |
| 569 |
|
print HTML "<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><th>Total:</th>"; |
| 570 |
|
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 571 |
|
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 572 |
|
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 573 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
| 574 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
| 575 |
|
printf HTML "<td style=\"background-color: %s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 576 |
|
printf HTML "<td align=right>%d</td>", $po_total{'total'}; |
| 577 |
|
print HTML "</tr>\n"; |
| 578 |
|
print HTML "</table>\n"; |
| 579 |
|
} |
| 580 |
|
|
| 581 |
|
# outputs footer |
| 582 |
|
print HTML "<hr><address>Compiled at $date</address>\n"; |
| 583 |
|
print HTML "</body></html>"; |
| 584 |
|
close (HTML); |
| 585 |
|
} |
| 586 |
} |
} |
| 587 |
} |
} |
| 588 |
print "\n" if ($config{'verbose'}); |
print "\n" if ($config{'verbose'}); |
| 590 |
# =============== Creating index.html =============== |
# =============== Creating index.html =============== |
| 591 |
print "Creating index.html... " if ($config{'verbose'}); |
print "Creating index.html... " if ($config{'verbose'}); |
| 592 |
|
|
| 593 |
open (HTML, ">$config{'htmldir'}/index.html") |
open (HTMLI, ">$config{'htmldir'}/index.html") |
| 594 |
|| die "Can't open $config{'htmldir'}/index.html"; |
|| die "Can't open $config{'htmldir'}/index.html"; |
| 595 |
|
|
| 596 |
printf HTML "<html>\n<head><title>%s</title></head>\n<body bgcolor=\"#ffffff\">\n", $config{'title'}; |
# printf HTMLI "<html>\n<head><title>%s</title></head>\n<body bgcolor=\"#ffffff\">\n", $config{'title'}; |
| 597 |
printf HTML "<h1 align=\"center\">%s</h1>\n", $config{'title'}; |
# printf HTMLI "<h1 align=\"center\">%s</h1>\n", $config{'title'}; |
| 598 |
|
printf HTMLI "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n"; |
| 599 |
print HTML "<h2>Translated web pages</h2>\n"; |
printf HTMLI " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"; |
| 600 |
printf HTML "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
printf HTMLI " <title>%s</title>\n", $config{'title'}; |
| 601 |
|
print HTMLI " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">"; |
| 602 |
print HTML $border_head; |
printf HTMLI "</head>\n<body>\n"; |
| 603 |
print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
printf HTMLI "<h1>%s</h1>\n", $config{'title'}; |
| 604 |
print HTML "<tr><th>Language</th><th>Translations</th><th>Up to date</th><th>Outdated</th><th>Not translated</th></tr>\n"; |
print HTMLI "<h2>Translated web pages</h2>\n"; |
| 605 |
|
printf HTMLI "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'}); |
| 606 |
|
|
| 607 |
|
# print HTMLI $border_head; |
| 608 |
|
print HTMLI "<table summary=\"Translation Statistics by Page Count\" class=\"stattrans\">\n"; |
| 609 |
|
print HTMLI "<colgroup width=\"20%\">\n"; |
| 610 |
|
print HTMLI "<col>\n"; |
| 611 |
|
print HTMLI "</colgroup>"; |
| 612 |
|
print HTMLI "<colgroup width=\"10%\">\n"; |
| 613 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 614 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 615 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 616 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 617 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 618 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 619 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 620 |
|
print HTMLI "<col width=\"10%\">\n"; |
| 621 |
|
print HTMLI "</colgroup>"; |
| 622 |
|
print HTMLI "<thead>"; |
| 623 |
|
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"; |
| 624 |
|
print HTMLI "</thead>"; |
| 625 |
|
print HTMLI "<tbody>"; |
| 626 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 627 |
$l = $langs{$lang}; |
my @processed_langs = ($langs{$lang}); |
| 628 |
$l = "zh-cn" if ($l eq "zh"); # kludge |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 629 |
|
foreach $l (@processed_langs) { |
| 630 |
|
$color_a = get_color ($percent_a{$lang}); |
| 631 |
|
$color_t = get_color ($percent_t{$lang}); |
| 632 |
|
$color_o = get_color (100 - $percent_o{$lang}); |
| 633 |
|
$color_u = get_color (100 - $percent_u{$lang}); |
| 634 |
|
|
| 635 |
|
print HTMLI "<tr>"; |
| 636 |
|
printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
| 637 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang}; |
| 638 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang}; |
| 639 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang}; |
| 640 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang}; |
| 641 |
|
print HTMLI "</tr>\n"; |
| 642 |
|
} |
| 643 |
|
} |
| 644 |
|
print HTMLI "</tbody>"; |
| 645 |
|
print HTMLI "</table>\n"; |
| 646 |
|
# print HTMLI $border_foot; |
| 647 |
|
|
| 648 |
|
print HTMLI "<h2>Translated web pages (by size)</h2>\n"; |
| 649 |
|
printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'}); |
| 650 |
|
|
| 651 |
|
# print HTMLI $border_head; |
| 652 |
|
print HTMLI "<table summary=\"Translation Statistics by Page Size\" class=\"stattrans\">\n"; |
| 653 |
|
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 654 |
|
print HTMLI "<colgroup span=\"1\">\n"; |
| 655 |
|
print HTMLI "<col width=\"20%\">\n"; |
| 656 |
|
print HTMLI "</colgroup>"; |
| 657 |
|
print HTMLI "<colgroup span=\"8\">\n"; |
| 658 |
|
print HTMLI "<col width=\"13%\">\n"; |
| 659 |
|
print HTMLI "<col width=\"7%\">\n"; |
| 660 |
|
print HTMLI "<col width=\"13%\">\n"; |
| 661 |
|
print HTMLI "<col width=\"7%\">\n"; |
| 662 |
|
print HTMLI "<col width=\"13%\">\n"; |
| 663 |
|
print HTMLI "<col width=\"7%\">\n"; |
| 664 |
|
print HTMLI "<col width=\"13%\">\n"; |
| 665 |
|
print HTMLI "<col width=\"7%\">\n"; |
| 666 |
|
print HTMLI "</colgroup>"; |
| 667 |
|
print HTMLI "<thead>"; |
| 668 |
|
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"; |
| 669 |
|
print HTMLI "</thead>"; |
| 670 |
|
print HTMLI "<tbody>"; |
| 671 |
|
|
| 672 |
$color_a = get_color ($percent_a{$lang}); |
foreach $lang (@search_in) { |
| 673 |
$color_t = get_color ($percent_t{$lang}); |
my @processed_langs = ($langs{$lang}); |
| 674 |
$color_o = get_color (100 - $percent_o{$lang}); |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 675 |
$color_u = get_color (100 - $percent_u{$lang}); |
foreach $l (@processed_langs) { |
| 676 |
|
$color_a = get_color ($percent_a{$lang}); |
| 677 |
print HTML "<tr>"; |
$color_t = get_color ($percent_t{$lang}); |
| 678 |
printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, ucfirst $lang, $l; |
$color_o = get_color (100 - $percent_o{$lang}); |
| 679 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang}; |
$color_u = get_color (100 - $percent_u{$lang}); |
| 680 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang}; |
|
| 681 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang}; |
print HTMLI "<tr>"; |
| 682 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang}; |
printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
| 683 |
print HTML "</tr>\n", |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml_s{$lang}, $percent_as{$lang}; |
| 684 |
} |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated_s{$lang}, $percent_ts{$lang}; |
| 685 |
print HTML "</table>\n"; |
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated_s{$lang}, $percent_os{$lang}; |
| 686 |
print HTML $border_foot; |
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}; |
| 687 |
|
print HTMLI "</tr>\n"; |
| 688 |
print HTML "<h2>Translated templates (gettext files)</h2>\n"; |
} |
| 689 |
printf HTML "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
} |
| 690 |
print HTML $border_head; |
print HTMLI "</tbody>"; |
| 691 |
print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
print HTMLI "</table>\n"; |
| 692 |
print HTML "<tr><th>Language</th><th>Up to date</th><th>Fuzzy</th><th>Not translated</th></tr>\n"; |
# print HTMLI $border_foot; |
| 693 |
|
|
| 694 |
|
print HTMLI "<h2>Translated templates (gettext files)</h2>\n"; |
| 695 |
|
printf HTMLI "<p>There are %d strings to translate.</p>\n",$po_total{'total'}; |
| 696 |
|
# print HTMLI $border_head; |
| 697 |
|
print HTMLI "<table summary=\"Gettext Translation Statistics\"class=\"stattrans\">\n"; |
| 698 |
|
# print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n"; |
| 699 |
|
print HTMLI "<colgroup span=\"1\"width=\"28%\">\n"; |
| 700 |
|
print HTMLI "</colgroup>"; |
| 701 |
|
print HTMLI "<colgroup span=\"6\" width=\"12%\">\n"; |
| 702 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 703 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 704 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 705 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 706 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 707 |
|
print HTMLI "<col width=\"12%\">\n"; |
| 708 |
|
print HTMLI "</colgroup>"; |
| 709 |
|
print HTMLI "<thead>"; |
| 710 |
|
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"; |
| 711 |
|
print HTMLI "</thead>"; |
| 712 |
|
print HTMLI "<tbody>"; |
| 713 |
foreach $lang (@search_in) { |
foreach $lang (@search_in) { |
| 714 |
next if $lang eq 'english'; |
next if $lang eq 'english'; |
| 715 |
$l = $langs{$lang}; |
my @processed_langs = ($langs{$lang}); |
| 716 |
$l = "zh-cn" if ($l eq "zh"); # kludge |
@processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; |
| 717 |
|
foreach $l (@processed_langs) { |
| 718 |
|
print HTMLI "<tr>"; |
| 719 |
|
printf HTMLI "<th><a href=\"%s.html#gettext\">%s</a> (%s)</th>", $l, ucfirst $lang, $l; |
| 720 |
|
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
| 721 |
|
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
| 722 |
|
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
| 723 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
| 724 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
| 725 |
|
printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
| 726 |
|
print HTMLI "</tr>\n"; |
| 727 |
|
} |
| 728 |
|
} |
| 729 |
|
|
| 730 |
print HTML "<tr>"; |
print HTMLI "</tbody>"; |
| 731 |
printf HTML "<td><a href=\"%s.html#gettext\">%s</a> (%s)</td>", $l, ucfirst $lang, $l; |
print HTMLI "</table>\n"; |
| 732 |
$color_t = get_color ($percent_po_t{'total'}{$lang}); |
# print HTMLI $border_foot; |
| 733 |
$color_f = get_color (100 - $percent_po_f{'total'}{$lang}); |
|
| 734 |
$color_u = get_color (100 - $percent_po_u{'total'}{$lang}); |
print HTMLI "<p><hr>\n"; |
| 735 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang}; |
print HTMLI "<p><address>Created with <a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/stattrans.pl?view=markup\&root=webwml\">webwml-stattrans</a> on $date</address>\n"; |
| 736 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang}; |
print HTMLI "</body></html>\n"; |
| 737 |
printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $percent_po_u{'total'}{$lang}; |
close (HTMLI); |
|
print HTML "</tr>\n"; |
|
|
} |
|
|
|
|
|
print HTML "</table>\n"; |
|
|
print HTML $border_foot; |
|
|
|
|
|
print HTML "<p><hr noshade size=1 width=\"100%\">\n"; |
|
|
print HTML "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n"; |
|
|
print HTML "</body></html>\n"; |
|
|
close (HTML); |
|
| 738 |
|
|
| 739 |
print "done.\n" if ($config{'verbose'}); |
print "done.\n" if ($config{'verbose'}); |
| 740 |
|
|