/[webwml]/webwml/stattrans.pl
ViewVC logotype

Diff of /webwml/stattrans.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.64 by thuriaux, Sat Apr 16 11:08:44 2005 UTC revision 1.94 by porridge, Sat Oct 16 10:58:50 2010 UTC
# Line 15  Line 15 
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;
# Line 36  $opt_t = "Debian web site translation st Line 36  $opt_t = "Debian web site translation st
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;
# Line 49  $opt_p =~ s/$/\$/g; Line 51  $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);
# Line 77  $altcvs->options( Line 80  $altcvs->options(
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    
# Line 88  my %original; Line 87  my %original;
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  #  #
# Line 97  sub getwmlfiles Line 97  sub getwmlfiles
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 {
# Line 125  sub getwmlfiles Line 129  sub getwmlfiles
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
# Line 174  sub check_translation Line 187  sub check_translation
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 "";
# Line 210  my ( %percent_po_t, %percent_po_u, %perc Line 225  my ( %percent_po_t, %percent_po_u, %perc
225  foreach $lang (@search_in) {  foreach $lang (@search_in) {
226      next if $lang eq 'english';      next if $lang eq 'english';
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;
# Line 219  foreach $lang (@search_in) { Line 241  foreach $lang (@search_in) {
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);
# Line 231  foreach $lang (@search_in) { Line 253  foreach $lang (@search_in) {
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'});
# Line 251  print "done.\n" if ($config{'verbose'}); Line 269  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) {
# Line 261  foreach $lang (@search_in) { Line 315  foreach $lang (@search_in) {
315      foreach $l (@processed_langs) {      foreach $l (@processed_langs) {
316          print "$l.html " if ($config{'verbose'});          print "$l.html " if ($config{'verbose'});
317    
318          $t_body = $u_body = $o_body = "";                  $charset{$lang};
319                    open (wmlrc,"$opt_w/$lang/.wmlrc") ;
320                    while (<wmlrc>) {
321                            if ( /^-D CHARSET=(.*)$/ ) {
322                                    $charset{$lang} = $1;
323                            }
324                    }
325                    close wmlrc ;
326    
327            $t_body = $u_body = $ui_body = $un_body = $uu_body = $o_body = "";
328          $translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0;          $translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0;
329    
330          # get stats about files          # get stats about files
331          foreach $file (@filenames) {          foreach $file (@filenames) {
332              next if ($file eq "");              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              # Translated pages
336              if (index ($wmlfiles{$lang}, " $file ") >= 0) {              if (index ($wmlfiles{$lang}, " $file ") >= 0) {
337                  $translated{$lang}++;                  $translated{$lang}++;
338                    $translated_s{$lang} += $sizes{$file};
339                  $orig = $original{"$lang/$file"} || "english";                  $orig = $original{"$lang/$file"} || "english";
340                  # Outdated translations                  # Outdated translations
341                  $msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");                  $msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
342                  if (length ($msg)) {                  if (length ($msg)) {
343                      $o_body .= "<tr>";                      $o_body .= "<tr>";
344                      if (($file !~ /\.wml$/)                      if (($file !~ /\.wml$/)
345                          || ($file eq "devel/wnpp/wnpp.wml")) {                          || ($file eq "devel/wnpp/wnpp.wml")) {
346                          $o_body .= sprintf "<td>%s</td>", $file;                          $o_body .= sprintf "<td>%s</td>", $file;
347                      } else {                      } else {
348                          (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=\"/%s.%s.html\">%s</a></td>", $base, $l, $base;  
349                      }                      }
350                      $o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"};                      $o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"};
351                      $o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"};                      $o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"};
352                      $o_body .= sprintf "<td>%s</td>", $msg;                      $o_body .= sprintf "<td>%s</td>", $msg;
353                      $o_body .= sprintf "<td>&nbsp;&nbsp;<a href=\"http://cvs.debian.org/webwml/$orig/%s.diff\?r1=%s\&amp;r2=%s\&amp;cvsroot=webwml\&amp;diff_format=%s\">%s -> %s</a></td>", $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $config{'difftype'}, $transversion{"$lang/$file"}, $version{"$orig/$file"};                      if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") {
354                      $o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s?cvsroot=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"};                          $o_body .= "<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\&amp;view=diff\&amp;r1=%s\&amp;r2=%s\&amp;diff_format=%s\">%s\&nbsp;->\&nbsp;%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\&amp;view=diff\&amp;r1=%s\&amp;r2=%s\&amp;diff_format=%s\">%s\&nbsp;->\&nbsp;%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\&amp;view=markup\&amp;revision=%s\">[V]</a>\&nbsp;", $lang, $file, $version{"$orig/$file"};
363                        $o_body .= sprintf "<a href=\"http://alioth.debian.org/scm/viewvc.php/*checkout*/webwml/%s/%s?root=webwml\&amp;revision=%s\">[F]</a></td>", $lang, $file, $version{"$orig/$file"};
364                      $o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || "";                      $o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || "";
365                      $o_body .= "</tr>\n";                      $o_body .= "</tr>\n";
366                      $outdated{$lang}++;                      $outdated{$lang}++;
367                        $outdated_s{$lang} += $sizes{$file};
368                  # Up-to-date translations                  # Up-to-date translations
369                  } else {                  } else {
370                      if (($file !~ /\.wml$/)                      if (($file !~ /\.wml$/)
371                          || ($file eq "devel/wnpp/wnpp.wml")) {                          || ($file eq "devel/wnpp/wnpp.wml")) {
372                          $t_body .= sprintf "%s<br>\n", $file;                          $t_body .= sprintf "<li>%s</li>\n", $file;
373                      } else {                      } else {
374                          (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 "<a href=\"/%s.%s.html\">%s</a><br>\n", $base, $l, $base;  
375                      }                      }
376                  }                  }
377              }              }
378              # Untranslated pages              # Untranslated pages
379              else {              else {
380                    my $u_tmp;
381                  if (($file !~ /\.wml$/)                  if (($file !~ /\.wml$/)
382                      || ($file eq "devel/wnpp/wnpp.wml")) {                      || ($file eq "devel/wnpp/wnpp.wml")) {
383                      $u_body .= sprintf "%s<br>\n", $file;                      $u_tmp = sprintf "<tr><td>%s</td><td>&nbsp;</td></tr>\n", $file;
384                  } else {                  } else {
385                      (my $base = $file) =~ s/\.wml$//;                      $u_tmp = sprintf "<tr><td><a title=\"%s\" href=\"$opt_b/%s\">%s&nbsp;&nbsp;(%s)</a></td><td align=\"right\">%d</td><td>(%.2f&nbsp;&permil;)</td></tr>\n", $hits, $base, $base, $version{"$orig/$file"}, $sizes{$file}, $sizes{$file}/$nsize * 1000;
                     $u_body .= sprintf "<a href=\"/%s\">%s</a><br>\n", $base, $base;  
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 {
399                        $u_body .= $u_tmp;
400                    }
401                  $untranslated{$lang}++;                  $untranslated{$lang}++;
402                    $untranslated_s{$lang} += $sizes{$file};
403              }              }
404          }          }
405    
406    
407          # this is where we discard the files that the translation directory contains          # this is where we discard the files that the translation directory contains
408          # but which don't exist in the English directory          # but which don't exist in the English directory
409          #   print "extra files: ".$wml{$lang}-$translated{$lang}."\n";          #   print "extra files: ".$wml{$lang}-$translated{$lang}."\n";
410          $wml{$lang} = $translated{$lang};          $wml{$lang} = $translated{$lang};
411            $wml_s{$lang} = $translated_s{$lang};
412          $translated{$lang} = $translated{$lang} - $outdated{$lang};          $translated{$lang} = $translated{$lang} - $outdated{$lang};
413            $translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang};
414    
415          if ($nfiles > 0) {          if ($nfiles > 0) {
416              $percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5);              $percent_a{$lang} = $wml{$lang}/$nfiles * 100;
417          } else {          } else {
418              $percent_a{$lang} = 0;              $percent_a{$lang} = 0;
419          }          }
420            if ($nsize > 0) {
421                $percent_as{$lang} = $wml_s{$lang}/$nsize * 100;
422            } else {
423                $percent_as{$lang} = 0;
424            }
425          if ($wml{$lang} > 0) {          if ($wml{$lang} > 0) {
426              $percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5);              $percent_t{$lang} = $translated{$lang}/$wml{$lang} * 100;
427          } else {          } else {
428              $percent_t{$lang} = 0;              $percent_t{$lang} = 0;
429          }          }
430            if ($wml_s{$lang} > 0) {
431                $percent_ts{$lang} = $translated_s{$lang}/$wml_s{$lang} * 100;
432            } else {
433                $percent_ts{$lang} = 0;
434            }
435          $percent_o{$lang} = 100 - $percent_t{$lang};          $percent_o{$lang} = 100 - $percent_t{$lang};
436            $percent_os{$lang} = 100 - $percent_ts{$lang};
437          $percent_u{$lang} = 100 - $percent_a{$lang};          $percent_u{$lang} = 100 - $percent_a{$lang};
438            $percent_us{$lang} = 100 - $percent_as{$lang};
439    
440          if (open (HTML, ">$config{'htmldir'}/$l.html")) {          if (open (HTML, ">$config{'htmldir'}/$l.html")) {
441              printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang;              printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
442                # printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang;
443                printf HTML "<html>\n<head>\n";
444                printf HTML "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset{$lang}\">\n";
445                printf HTML "  <title>%s: %s</title>\n", $config{'title'}, ucfirst $lang;
446                print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">";
447                print HTML "</head>\n<body>\n";
448              $color = get_color ($percent_a{$lang});              $color = get_color ($percent_a{$lang});
449    
450              print HTML "<a name=\"top\"></a>\n";              printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color;
451              printf HTML "<table width=\"100%%\" cellpadding=2 cellspacing=0 bgcolor=\"%s\">\n", $color;              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              printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang;              print HTML "<colgroup span=\"4\" width=\"25%\"></colgroup>\n";
454                # printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang;
455              print HTML "<tr>\n";  
456              printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) translated</b></td>", $wml{$lang}, $percent_a{$lang};              print HTML "<tr><th>Translated</th><th>Up-to-date</th><th>Outdated</th><th>Not translated</th></tr>\n<tr>";
457              printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) up to date</b></td>", $translated{$lang}, $percent_t{$lang};              printf HTML "<td>%d files (%.1f%%)</td>", $wml{$lang}, $percent_a{$lang};
458              printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) outdated</b></td>", $outdated{$lang}, $percent_o{$lang};              printf HTML "<td>%d files (%.1f%%)</td>", $translated{$lang}, $percent_t{$lang};
459              printf HTML "<td align=\"center\" width=\"25%%\"><b>%d files (%d%%) not translated</b></td>", $untranslated{$lang}, $percent_u{$lang};              printf HTML "<td>%d files (%.1f%%)</td>", $outdated{$lang}, $percent_o{$lang};
460                printf HTML "<td>%d files (%.1f%%)</td>", $untranslated{$lang}, $percent_u{$lang};
461              print HTML "</tr>\n";              print HTML "</tr>\n";
462                print HTML "<tr>\n";
463                printf HTML "<td>%d bytes (%.1f%%)</td>", $wml_s{$lang}, $percent_as{$lang};
464                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                printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang};
467                print HTML "</tr>\n";
468              print HTML "</table>\n";              print HTML "</table>\n";
469    
470              # Make the table of content              # Make the table of content
471              print HTML "<h3>Table of Contents</h3>\n";              print HTML "<h3>Table of Contents</h3>\n";
472              print HTML "<p><a href=\"./\">Back to index of languages</a></p>\n";              print HTML "<ul>\n";
473              print HTML "<br /><a href=\"../\">Working on the website</a>\n";              print HTML "<li><a href=\"./\">Back to index of languages</a></li>\n";
474                print HTML "<li><a href=\"../\">Working on the website</a></li>\n";
475              if ($o_body) {              if ($o_body) {
476                  print HTML "<br /><a href=\"#outdated\">Outdated translations</a>\n";                  print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n";
477              }              }
478              if ($u_body) {              if (($u_body) || ($ui_body) || ($un_body) || ($uu_body)) {
479                  print HTML "<br /><a href=\"#untranslated\">Pages not translated</a>\n";                  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) {              if ($t_body) {
496                  print HTML "<br /><a href=\"#uptodate\">Translations up to date</a>\n";                  print HTML "<li><a href=\"#uptodate\">Translated pages (up-to-date)</a></li>\n";
497              }              }
498              if ($lang ne 'english') {              if ($lang ne 'english') {
499                  print HTML "<br /><a href=\"#gettext\">Translations of templates (gettext files)</a>\n";                  print HTML "<li><a href=\"#gettext\">Translation of templates (gettext files)</a></li>\n";
500              }              }
501              print HTML "</p>\n";              print HTML "</ul>\n";
502    
503              # outputs the content              # outputs the content
504              if ($o_body) {              if ($o_body) {
505                  print HTML "<h3><a name='outdated'>Outdated translations</a>: <a href='#top'>(top)</a></h3>\n";                  print HTML "<h3 id='outdated'>Outdated translations: <a href='#top'>(top)</a></h3>\n";
506                  print HTML "<table border=0 cellpadding=1 cellspacing=1>\n";                  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>";                  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>"; }                  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>"; }                  elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th><th>Unified diff</th>"; }
510                  else { print HTML "<th>Diff</th>"; }                  else { print HTML "<th>Diff</th>"; }
511                  print HTML "<th>Log</th>";                  print HTML "<th>Log</th>";
512                    print HTML "<th>Translation</th>";
513                  print HTML "<th>Maintainer</th>";                  print HTML "<th>Maintainer</th>";
514                  print HTML "</tr>\n";                  print HTML "</tr>\n";
515                  print HTML $o_body;                  print HTML $o_body;
516                  print HTML "</table>\n";                  print HTML "</table>\n";
517              }              }
518              if ($u_body) {              if ($u_body) {
519                  print HTML "<h3><a name='untranslated'>Pages not translated</a>: <a href='#top'>(top)</a></h3>\n";                  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;                  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) {              if ($t_body) {
543                  print HTML "<h3><a name='uptodate'>Translations up to date</a>: <a href='#top'>(top)</a></h3>\n";                  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;                  print HTML $t_body;
546                    print HTML "</ul>\n";
547              }              }
548              # outputs the gettext stats              # outputs the gettext stats
549              if ($lang ne 'english') {              if ($lang ne 'english') {
550                  print HTML "<h3><a name='gettext'>Translations of templates (gettext files)</a>: <a href='#top'>(top)</a></h3>\n";                  print HTML "<h3 id='gettext'>Translation of templates (gettext files): <a href='#top'>(top)</a></h3>\n";
551      #            print HTML $border_head;  #               print HTML $border_head;
552                  print HTML "<table width=\"100%\" border=0>\n";                  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";                  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) {                  foreach my $domain (sort keys %po_total) {
555                      next if $domain eq 'total';                      next if $domain eq 'total';
556                      print HTML "<tr>";                      print HTML "<tr>";
557    
558                      $color_t = get_color ($percent_po_t{$domain}{$lang});                      $color_t = get_color ($percent_po_t{$domain}{$lang});
559                      $color_f = get_color (100 - $percent_po_f{$domain}{$lang});                      $color_f = get_color (100 - $percent_po_f{$domain}{$lang});
560                      $color_u = get_color (100 - $percent_po_u{$domain}{$lang});                      $color_u = get_color (100 - $percent_po_u{$domain}{$lang});
561    
562                      print HTML "<td>$domain.$langs{$lang}.po</td>";                      print HTML "<td>$domain.$langs{$lang}.po</td>";
563                      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{$domain}{$lang}, $percent_po_t{$domain}{$lang};                      printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_t, $po_translated{$domain}{$lang},   $percent_po_t{$domain}{$lang};
564                      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{$domain}{$lang}, $percent_po_f{$domain}{$lang};                      printf HTML "<td style=\"background-color: %s\" align=right>%d (%s%%)</td>", $color_f, $po_fuzzy{$domain}{$lang},        $percent_po_f{$domain}{$lang};
565                      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $po_untranslated{$domain}{$lang}, $percent_po_u{$domain}{$lang};                      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};                      printf HTML "<td align=right>%d</td>", $po_total{$domain};
567                      print HTML "</tr>\n";                      print HTML "</tr>\n";
568                  }                  }
# Line 417  foreach $lang (@search_in) { Line 570  foreach $lang (@search_in) {
570                  $color_t = get_color ($percent_po_t{'total'}{$lang});                  $color_t = get_color ($percent_po_t{'total'}{$lang});
571                  $color_f = get_color (100 - $percent_po_f{'total'}{$lang});                  $color_f = get_color (100 - $percent_po_f{'total'}{$lang});
572                  $color_u = get_color (100 - $percent_po_u{'total'}{$lang});                  $color_u = get_color (100 - $percent_po_u{'total'}{$lang});
573                  printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $percent_po_t{'total'}{$lang};                  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 bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $percent_po_f{'total'}{$lang};                  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 bgcolor=\"%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};
576                  printf HTML "<td align=right>%d</td>", $po_total{'total'};                  printf HTML "<td align=right>%d</td>", $po_total{'total'};
577                  print HTML "</tr>\n";                  print HTML "</tr>\n";
578                    print HTML "</table>\n";
579              }              }
580              print HTML "</table>\n";  
   
581              # outputs footer              # outputs footer
582              print HTML "<hr><address>Compiled at $date</address>\n";              print HTML "<hr><address>Compiled at $date</address>\n";
583              print HTML "</body></html>";              print HTML "</body></html>";
# Line 437  print "\n" if ($config{'verbose'}); Line 590  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 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 "<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      my @processed_langs = ($langs{$lang});      my @processed_langs = ($langs{$lang});
628      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
# Line 458  foreach $lang (@search_in) { Line 632  foreach $lang (@search_in) {
632          $color_o = get_color (100 - $percent_o{$lang});          $color_o = get_color (100 - $percent_o{$lang});
633          $color_u = get_color (100 - $percent_u{$lang});          $color_u = get_color (100 - $percent_u{$lang});
634    
635          print HTML "<tr>";          print HTMLI "<tr>";
636          printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, ucfirst $lang, $l;          printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l;
637          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang};          printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml{$lang},          $percent_a{$lang};
638          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang};          printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated{$lang},   $percent_t{$lang};
639          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang};          printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated{$lang},     $percent_o{$lang};
640          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang};          printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang};
641          print HTML "</tr>\n";          print HTMLI "</tr>\n";
642      }      }
643  }  }
644  print HTML "</table>\n";  print HTMLI "</tbody>";
645  print HTML $border_foot;  print HTMLI "</table>\n";
646    # print HTMLI $border_foot;
647  print HTML "<h2>Translated templates (gettext files)</h2>\n";  
648  printf HTML "<p>There are %d strings to translate.</p>\n",$po_total{'total'};  print HTMLI "<h2>Translated web pages (by size)</h2>\n";
649  print HTML $border_head;  printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'});
650  print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n";  
651  print HTML "<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 $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    foreach $lang (@search_in) {
673        my @processed_langs = ($langs{$lang});
674        @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
675        foreach $l (@processed_langs) {
676            $color_a = get_color ($percent_a{$lang});
677            $color_t = get_color ($percent_t{$lang});
678            $color_o = get_color (100 - $percent_o{$lang});
679            $color_u = get_color (100 - $percent_u{$lang});
680    
681            print HTMLI "<tr>";
682            printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l;
683            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            printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated_s{$lang},              $percent_os{$lang};
686            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        }
689    }
690    print HTMLI "</tbody>";
691    print HTMLI "</table>\n";
692    # 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      my @processed_langs = ($langs{$lang});      my @processed_langs = ($langs{$lang});
716      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
717      foreach $l (@processed_langs) {      foreach $l (@processed_langs) {
718          print HTML "<tr>";          print HTMLI "<tr>";
719          printf HTML "<td><a href=\"%s.html#gettext\">%s</a> (%s)</td>", $l, ucfirst $lang, $l;          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});          $color_t = get_color ($percent_po_t{'total'}{$lang});
721          $color_f = get_color (100 - $percent_po_f{'total'}{$lang});          $color_f = get_color (100 - $percent_po_f{'total'}{$lang});
722          $color_u = get_color (100 - $percent_po_u{'total'}{$lang});          $color_u = get_color (100 - $percent_po_u{'total'}{$lang});
723          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_t, $po_translated{'total'}{$lang}, $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};
724          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_f, $po_fuzzy{'total'}{$lang}, $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};
725          printf HTML "<td bgcolor=\"%s\" align=right>%d</td><td>(%d%%)</td>", $color_u, $po_untranslated{'total'}{$lang}, $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};
726          print HTML "</tr>\n";          print HTMLI "</tr>\n";
727      }      }
728  }  }
729    
730  print HTML "</table>\n";  print HTMLI "</tbody>";
731  print HTML $border_foot;  print HTMLI "</table>\n";
732    # print HTMLI $border_foot;
733  print HTML "<p><hr noshade size=1 width=\"100%\">\n";  
734  print HTML "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n";  print HTMLI "<p><hr>\n";
735  print HTML "</body></html>\n";  print HTMLI "<p><address>Created with <a href=\"http://alioth.debian.org/scm/viewvc.php/webwml/stattrans.pl?view=markup\&amp;root=webwml\">webwml-stattrans</a> on $date</address>\n";
736  close (HTML);  print HTMLI "</body></html>\n";
737    close (HTMLI);
738    
739  print "done.\n" if ($config{'verbose'});  print "done.\n" if ($config{'verbose'});
740    

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.94

  ViewVC Help
Powered by ViewVC 1.1.5