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

Diff of /webwml/stattrans.pl

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

revision 1.63 by djpig, Thu Sep 16 23:40:06 2004 UTC revision 1.81 by fbothamy, Fri Feb 9 22:16:07 2007 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    getopts('h:w:b:p:t:vd:l:') || die;
41  #  Replace filename globbing by Perl regexps  #  Replace filename globbing by Perl regexps
42  $opt_p =~ s/\./\\./g;  $opt_p =~ s/\./\\./g;
43  $opt_p =~ s/\?/./g;  $opt_p =~ s/\?/./g;
# Line 77  $altcvs->options( Line 78  $altcvs->options(
78  $max_versions = 5;  $max_versions = 5;
79  $min_versions = 1;  $min_versions = 1;
80    
 $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>";  
   
81    
82  $date = strftime "%a %b %e %H:%M:%S %Y %z", localtime;  $date = strftime "%a %b %e %H:%M:%S %Y %z", localtime;
83    
# Line 88  my %original; Line 85  my %original;
85  my %transversion;  my %transversion;
86  my %version;  my %version;
87  my %files;  my %files;
88    my %sizes;
89    
90  # Count wml files in given directory  # Count wml files in given directory
91  #  #
# Line 97  sub getwmlfiles Line 95  sub getwmlfiles
95      my $dir = "$config{'wmldir'}/$lang";      my $dir = "$config{'wmldir'}/$lang";
96      my $cutfrom = length ($config{'wmldir'})+length($lang)+2;      my $cutfrom = length ($config{'wmldir'})+length($lang)+2;
97      my $count = 0;      my $count = 0;
98        my $size = 0;
99      my $is_english = ($lang eq "english")?1:0;      my $is_english = ($lang eq "english")?1:0;
100      my ( $file, $v );      my ( $file, $v );
101      my @listfiles;      my @listfiles;
# Line 125  sub getwmlfiles Line 124  sub getwmlfiles
124          } else {          } else {
125              $version{"$lang/$file"} = $altcvs->revision($f);              $version{"$lang/$file"} = $altcvs->revision($f);
126              if (!$transcheck->revision()) {              if (!$transcheck->revision()) {
127                  $original{"english/$file"} = $lang;                  $transcheckenglish = Webwml::TransCheck->new("english/$file");
128                  $transversion{"english/$file"} ||= "1.1";                  if (!$transcheckenglish->revision() and (-e "english/$file")) {
129                        $transversion{"$lang/$file"} = "1.1";
130                        $original{"$lang/$file"} = "english";
131                    } else {
132                        $original{"english/$file"} = $lang;
133                        $transversion{"english/$file"} ||= "1.1";
134                    }
135              }              }
136          }          }
137          if ($transcheck->maintainer()) {          if ($transcheck->maintainer()) {
138              $maintainer{"$lang/$file"} = $transcheck->maintainer();              $maintainer{"$lang/$file"} = $transcheck->maintainer();
139          }          }
140          $count++;          $count++;
141            $sizes{$file} = (stat "".($original{"english/$file"}||"english")."/".$file)[7];
142            $size += $sizes{$file};
143      }      }
144      $wmlfiles{$lang} .= " ";      $wmlfiles{$lang} .= " ";
145      $wml{$lang} = $count;      $wml{$lang} = $count;
146        $wml_s{$lang} = $size;
147  }  }
148    
149  sub get_color  sub get_color
# Line 174  sub check_translation Line 182  sub check_translation
182    
183          if ( $major_number != $major_translated_number ) {          if ( $major_number != $major_translated_number ) {
184              return "This translation is too out of date";              return "This translation is too out of date";
185            } elsif ( $last_number - $last_translated_number < 0 ) {
186                return "Wrong translation version";
187          } elsif ( $last_number - $last_translated_number >= $max_versions ) {          } elsif ( $last_number - $last_translated_number >= $max_versions ) {
188              return "This translation is too out of date";              return "This translation is too out of date";
189          } elsif ( $last_number - $last_translated_number >= $min_versions ) {          } elsif ( $last_number - $last_translated_number >= $min_versions ) {
190              return "The original is newer than this translation";              return "The original is newer than this translation";
191          }          }
192      } elsif ( !$version && $transversion) {      } elsif ( !$version && $translation) {
193          return "The original no longer exists";          return "The original no longer exists";
194      }      }
195      return "";      return "";
# Line 219  foreach $lang (@search_in) { Line 229  foreach $lang (@search_in) {
229          $po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0");          $po_untranslated{$domain}{$lang} = ($line =~ /(\d+) untranslated/ ? $1 : "0");
230    
231          $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};
232    
233          $po_translated{"total"}{$lang} += $po_translated{$domain}{$lang};          $po_translated{"total"}{$lang} += $po_translated{$domain}{$lang};
234          $po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang};          $po_fuzzy{"total"}{$lang} += $po_fuzzy{$domain}{$lang};
235          $po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang};          $po_untranslated{"total"}{$lang} += $po_untranslated{$domain}{$lang};
236    
237          if ($po_total{$domain} > 0) {          if ($po_total{$domain} > 0) {
238              $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);
239              $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 235  foreach $lang (@search_in) { Line 245  foreach $lang (@search_in) {
245          }          }
246      }      }
247      $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};
248    
249      if ($po_total{'total'} > 0) {      if ($po_total{'total'} > 0) {
250          $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);
251          $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);
# Line 253  mkdir ($config{'htmldir'}, 02775) if (! Line 263  mkdir ($config{'htmldir'}, 02775) if (!
263    
264  my @filenames = sort keys %files;  my @filenames = sort keys %files;
265  my $nfiles = scalar @filenames;  my $nfiles = scalar @filenames;
266    $nsize += $sizes{$_} foreach (@filenames);
267    
268  print "Creating files: " if ($config{'verbose'});  print "Creating files: " if ($config{'verbose'});
269  foreach $lang (@search_in) {  foreach $lang (@search_in) {
# Line 261  foreach $lang (@search_in) { Line 272  foreach $lang (@search_in) {
272      foreach $l (@processed_langs) {      foreach $l (@processed_langs) {
273          print "$l.html " if ($config{'verbose'});          print "$l.html " if ($config{'verbose'});
274    
275          $t_body = $u_body = $o_body = "";          $t_body = $u_body = $un_body = $uu_body = $o_body = "";
276            $translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0;
277    
278          # get stats about files          # get stats about files
279          foreach $file (@filenames) {          foreach $file (@filenames) {
# Line 269  foreach $lang (@search_in) { Line 281  foreach $lang (@search_in) {
281              # Translated pages              # Translated pages
282              if (index ($wmlfiles{$lang}, " $file ") >= 0) {              if (index ($wmlfiles{$lang}, " $file ") >= 0) {
283                  $translated{$lang}++;                  $translated{$lang}++;
284                    $translated_s{$lang} += $sizes{$file};
285                  $orig = $original{"$lang/$file"} || "english";                  $orig = $original{"$lang/$file"} || "english";
286                  # Outdated translations                  # Outdated translations
287                  $msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");                  $msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
288                  if (length ($msg)) {                  if (length ($msg)) {
289                      $o_body .= "<tr>";                      $o_body .= "<tr>";
290                      if (($file !~ /\.wml$/)                      if (($file !~ /\.wml$/)
291                          || ($file eq "devel/wnpp/wnpp.wml")) {                          || ($file eq "devel/wnpp/wnpp.wml")) {
292                          $o_body .= sprintf "<td>%s</td>", $file;                          $o_body .= sprintf "<td>%s</td>", $file;
293                      } else {                      } else {
294                          (my $base = $file) =~ s/\.wml$//;                          (my $base = $file) =~ s/\.wml$//;
295                          $o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $base, $l, $base;                          $o_body .= sprintf "<td><a href=\"$opt_b/%s.%s.html\">%s</a></td>", $base, $l, $base;
296                      }                      }
297                      $o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"};                      $o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"};
298                      $o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"};                      $o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"};
299                      $o_body .= sprintf "<td>%s</td>", $msg;                      $o_body .= sprintf "<td>%s</td>", $msg;
300                      $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") {
301                      $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>";
302                        } else {
303                            $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"};
304                            $o_body .= sprintf "<td><a href=\"http://cvs.debian.org/webwml/$orig/%s?cvsroot=webwml#rev%s\">[L]</a></td>", $file, $version{"$orig/$file"};
305                        }
306                      $o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || "";                      $o_body .= sprintf "<td align=center>%s</td>", $maintainer{"$lang/$file"} || "";
307                      $o_body .= "</tr>\n";                      $o_body .= "</tr>\n";
308                      $outdated{$lang}++;                      $outdated{$lang}++;
309                        $outdated_s{$lang} += $sizes{$file};
310                  # Up-to-date translations                  # Up-to-date translations
311                  } else {                  } else {
312                      if (($file !~ /\.wml$/)                      if (($file !~ /\.wml$/)
313                          || ($file eq "devel/wnpp/wnpp.wml")) {                          || ($file eq "devel/wnpp/wnpp.wml")) {
314                          $t_body .= sprintf "%s<br>\n", $file;                          $t_body .= sprintf "<li>%s</li>\n", $file;
315                      } else {                      } else {
316                          (my $base = $file) =~ s/\.wml$//;                          (my $base = $file) =~ s/\.wml$//;
317                          $t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $base, $l, $base;                          $t_body .= sprintf "<li><a href=\"$opt_b/%s.%s.html\">%s</a></li>\n", $base, $l, $base;
318                      }                      }
319                  }                  }
320              }              }
321              # Untranslated pages              # Untranslated pages
322              else {              else {
323                    my $u_tmp;
324                  if (($file !~ /\.wml$/)                  if (($file !~ /\.wml$/)
325                      || ($file eq "devel/wnpp/wnpp.wml")) {                      || ($file eq "devel/wnpp/wnpp.wml")) {
326                      $u_body .= sprintf "%s<br>\n", $file;                      $u_tmp = sprintf "<tr><td>%s</td><td>&nbsp;</td></tr>\n", $file;
327                  } else {                  } else {
328                      (my $base = $file) =~ s/\.wml$//;                      (my $base = $file) =~ s/\.wml$//;
329                      $u_body .= sprintf "<a href=\"/%s\">%s</a><br>\n", $base, $base;                      $u_tmp = sprintf "<tr><td><a href=\"$opt_b/%s\">%s</a></td><td align=\"right\">%d</td><td>(%.2f&nbsp;&permil;)</td></tr>\n", $base, $base, $sizes{$file}, $sizes{$file}/$nsize * 1000;
330                  }                  }
331                    if ((($file =~ /(News|events|security|vote)\/[0-9]{4}\//) &&
332                         ($file !~ /index.wml$/)) ||
333                        ($file =~ /(News\/weekly\/[0-9]{4}\/|security\/undated)/)) {
334                        $un_body .= $u_tmp;
335                    } elsif (($file =~ /(consultants|users\/(com|edu|gov|org))\//) &&
336                             ($file !~ /index.wml$/)) {
337                        $uu_body .=$u_tmp;
338                    } else {
339                        $u_body .= $u_tmp;
340                    }
341                  $untranslated{$lang}++;                  $untranslated{$lang}++;
342                    $untranslated_s{$lang} += $sizes{$file};
343              }              }
344          }          }
345    
346    
347          # this is where we discard the files that the translation directory contains          # this is where we discard the files that the translation directory contains
348          # but which don't exist in the English directory          # but which don't exist in the English directory
349          #   print "extra files: ".$wml{$lang}-$translated{$lang}."\n";          #   print "extra files: ".$wml{$lang}-$translated{$lang}."\n";
350          $wml{$lang} = $translated{$lang};          $wml{$lang} = $translated{$lang};
351            $wml_s{$lang} = $translated_s{$lang};
352          $translated{$lang} = $translated{$lang} - $outdated{$lang};          $translated{$lang} = $translated{$lang} - $outdated{$lang};
353            $translated_s{$lang} = $translated_s{$lang} - $outdated_s{$lang};
354    
355          if ($nfiles > 0) {          if ($nfiles > 0) {
356              $percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5);              $percent_a{$lang} = $wml{$lang}/$nfiles * 100;
357          } else {          } else {
358              $percent_a{$lang} = 0;              $percent_a{$lang} = 0;
359          }          }
360            if ($nsize > 0) {
361                $percent_as{$lang} = $wml_s{$lang}/$nsize * 100;
362            } else {
363                $percent_as{$lang} = 0;
364            }
365          if ($wml{$lang} > 0) {          if ($wml{$lang} > 0) {
366              $percent_t{$lang} = int ($translated{$lang}/$wml{$lang} * 100 + .5);              $percent_t{$lang} = $translated{$lang}/$wml{$lang} * 100;
367          } else {          } else {
368              $percent_t{$lang} = 0;              $percent_t{$lang} = 0;
369          }          }
370            if ($wml_s{$lang} > 0) {
371                $percent_ts{$lang} = $translated_s{$lang}/$wml_s{$lang} * 100;
372            } else {
373                $percent_ts{$lang} = 0;
374            }
375          $percent_o{$lang} = 100 - $percent_t{$lang};          $percent_o{$lang} = 100 - $percent_t{$lang};
376            $percent_os{$lang} = 100 - $percent_ts{$lang};
377          $percent_u{$lang} = 100 - $percent_a{$lang};          $percent_u{$lang} = 100 - $percent_a{$lang};
378            $percent_us{$lang} = 100 - $percent_as{$lang};
379    
380          if (open (HTML, ">$config{'htmldir'}/$l.html")) {          if (open (HTML, ">$config{'htmldir'}/$l.html")) {
381              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";
382                # printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang;
383                printf HTML "<html>\n<head>\n";
384                printf HTML "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
385                printf HTML "  <title>%s: %s</title>\n", $config{'title'}, ucfirst $lang;
386                print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">";
387                print HTML "</head>\n<body>\n";
388              $color = get_color ($percent_a{$lang});              $color = get_color ($percent_a{$lang});
389    
390              print HTML "<a name=\"top\"></a>\n";              printf HTML "<h1 style=\"background-color: %s\; margin: 0\;\"><a name=\"top\"></a>", $color;
391              printf HTML "<table width=\"100%%\" cellpadding=2 cellspacing=0 bgcolor=\"%s\">\n", $color;              printf HTML "%s: %s</h1>\n", $config{'title'}, ucfirst $lang;
392                printf HTML "<table summary=\"Translation Summary for $lang\" style=\"background-color: %s\; width: 100%\; font-weight: bold\; margin: 0\; text-align: center\;\">\n", $color;
393              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";
394                # printf HTML "<tr><td colspan=4><h1 align=\"center\">%s: %s</h1></td></tr>", $config{'title'}, ucfirst $lang;
395              print HTML "<tr>\n";  
396              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>";
397              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};
398              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};
399              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};
400                printf HTML "<td>%d files (%.1f%%)</td>", $untranslated{$lang}, $percent_u{$lang};
401              print HTML "</tr>\n";              print HTML "</tr>\n";
402                print HTML "<tr>\n";
403                printf HTML "<td>%d bytes (%.1f%%)</td>", $wml_s{$lang}, $percent_as{$lang};
404                printf HTML "<td>%d bytes (%.1f%%)</td>", $translated_s{$lang}, $percent_ts{$lang};
405                printf HTML "<td>%d bytes (%.1f%%)</td>", $outdated_s{$lang}, $percent_os{$lang};
406                printf HTML "<td>%d bytes (%.1f%%)</td>", $nsize-$wml_s{$lang}, $percent_us{$lang};
407                print HTML "</tr>\n";
408              print HTML "</table>\n";              print HTML "</table>\n";
409    
410              # Make the table of content              # Make the table of content
411              print HTML "<h3>Table of Contents</h3>\n";              print HTML "<h3>Table of Contents</h3>\n";
412              print HTML "<p><a href=\"./\">Back to index of languages</a></p>\n";              print HTML "<ul>\n";
413              print HTML "<br /><a href=\"../\">Working on the website</a>\n";              print HTML "<li><a href=\"./\">Back to index of languages</a></li>\n";
414                print HTML "<li><a href=\"../\">Working on the website</a></li>\n";
415              if ($o_body) {              if ($o_body) {
416                  print HTML "<br /><a href=\"#outdated\">Outdated translations</a>\n";                  print HTML "<li><a href=\"#outdated\">Outdated translations</a></li>\n";
417              }              }
418              if ($u_body) {              if (($u_body) || ($un_body) || ($uu_body)) {
419                  print HTML "<br /><a href=\"#untranslated\">Pages not translated</a>\n";                  print HTML "<li>Untranslated</li>\n";
420                    print HTML "<ul>\n";
421                    if ($u_body) {
422                        print HTML "<li><a href=\"#untranslated\">General pages</a></li>\n";
423                    }
424                    if ($un_body) {
425                        print HTML "<li><a href=\"#untranslated-news\">News items</a></li>\n";
426                    }
427                    if ($uu_body) {
428                        print HTML "<li><a href=\"#untranslated-user\">Consultant/user pages</a></li>\n";
429                    }
430                    print HTML "</ul>\n";
431              }              }
432              if ($t_body) {              if ($t_body) {
433                  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";
434              }              }
435              if ($lang ne 'english') {              if ($lang ne 'english') {
436                  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";
437              }              }
438              print HTML "</p>\n";              print HTML "</ul>\n";
439    
440              # outputs the content              # outputs the content
441              if ($o_body) {              if ($o_body) {
442                  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";
443                  print HTML "<table border=0 cellpadding=1 cellspacing=1>\n";                  print HTML "<table summary=\"Outdated translations\" border=0 cellpadding=1 cellspacing=1>\n";
444                  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>";
445                  if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; }                  if ($opt_d eq "u") { print HTML "<th>Unified diff</th>"; }
446                  elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; }                  elsif ($opt_d eq "h") { print HTML "<th>Colored diff</th>"; }
# Line 384  foreach $lang (@search_in) { Line 452  foreach $lang (@search_in) {
452                  print HTML "</table>\n";                  print HTML "</table>\n";
453              }              }
454              if ($u_body) {              if ($u_body) {
455                  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";
456                    print HTML "<table summary=\"Untranslated general pages\">\n";
457                  print HTML $u_body;                  print HTML $u_body;
458                    print HTML "</table>\n";
459                }
460                if ($un_body) {
461                    print HTML "<h3 id='untranslated-news'>News items not translated: <a href='#top'>(top)</a></h3>\n";
462                    print HTML "<table summary=\"Untranslated news items\">\n";
463                    print HTML $un_body;
464                    print HTML "</table>\n";
465                }
466                if ($uu_body) {
467                    print HTML "<h3 id='untranslated-user'>Consultant/user pages not translated: <a href='#top'>(top)</a></h3>\n";
468                    print HTML "<table summary=\"Untranslated consultant/user pages\">\n";
469                    print HTML $uu_body;
470                    print HTML "</table>\n";
471              }              }
472              if ($t_body) {              if ($t_body) {
473                  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";
474                    print HTML "<ul class=\"discless\">\n";
475                  print HTML $t_body;                  print HTML $t_body;
476                    print HTML "</ul>\n";
477              }              }
478              # outputs the gettext stats              # outputs the gettext stats
479              if ($lang ne 'english') {              if ($lang ne 'english') {
480                  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";
481      #            print HTML $border_head;  #               print HTML $border_head;
482                  print HTML "<table width=\"100%\" border=0>\n";                  print HTML "<table summary=\"Gettext statistics\" width=\"100%\">\n";
483                  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";
484                  foreach my $domain (sort keys %po_total) {                  foreach my $domain (sort keys %po_total) {
485                      next if $domain eq 'total';                      next if $domain eq 'total';
486                      print HTML "<tr>";                      print HTML "<tr>";
487    
488                      $color_t = get_color ($percent_po_t{$domain}{$lang});                      $color_t = get_color ($percent_po_t{$domain}{$lang});
489                      $color_f = get_color (100 - $percent_po_f{$domain}{$lang});                      $color_f = get_color (100 - $percent_po_f{$domain}{$lang});
490                      $color_u = get_color (100 - $percent_po_u{$domain}{$lang});                      $color_u = get_color (100 - $percent_po_u{$domain}{$lang});
491    
492                      print HTML "<td>$domain.$langs{$lang}.po</td>";                      print HTML "<td>$domain.$langs{$lang}.po</td>";
493                      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};
494                      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};
495                      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};
496                      printf HTML "<td align=right>%d</td>", $po_total{$domain};                      printf HTML "<td align=right>%d</td>", $po_total{$domain};
497                      print HTML "</tr>\n";                      print HTML "</tr>\n";
498                  }                  }
# Line 416  foreach $lang (@search_in) { Line 500  foreach $lang (@search_in) {
500                  $color_t = get_color ($percent_po_t{'total'}{$lang});                  $color_t = get_color ($percent_po_t{'total'}{$lang});
501                  $color_f = get_color (100 - $percent_po_f{'total'}{$lang});                  $color_f = get_color (100 - $percent_po_f{'total'}{$lang});
502                  $color_u = get_color (100 - $percent_po_u{'total'}{$lang});                  $color_u = get_color (100 - $percent_po_u{'total'}{$lang});
503                  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};
504                  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};
505                  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};
506                  printf HTML "<td align=right>%d</td>", $po_total{'total'};                  printf HTML "<td align=right>%d</td>", $po_total{'total'};
507                  print HTML "</tr>\n";                  print HTML "</tr>\n";
508                   print HTML "</table>\n";
509              }              }
510              print HTML "</table>\n";  
   
511              # outputs footer              # outputs footer
512              print HTML "<hr><address>Compiled at $date</address>\n";              print HTML "<hr><address>Compiled at $date</address>\n";
513              print HTML "</body></html>";              print HTML "</body></html>";
# Line 436  print "\n" if ($config{'verbose'}); Line 520  print "\n" if ($config{'verbose'});
520  # =============== Creating index.html ===============  # =============== Creating index.html ===============
521  print "Creating index.html... " if ($config{'verbose'});  print "Creating index.html... " if ($config{'verbose'});
522    
523  open (HTML, ">$config{'htmldir'}/index.html")  open (HTMLI, ">$config{'htmldir'}/index.html")
524      || die "Can't open $config{'htmldir'}/index.html";      || die "Can't open $config{'htmldir'}/index.html";
525    
526  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'};
527  printf HTML "<h1 align=\"center\">%s</h1>\n", $config{'title'};  # printf HTMLI "<h1 align=\"center\">%s</h1>\n", $config{'title'};
528    printf HTMLI "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n";
529  print HTML "<h2>Translated web pages</h2>\n";  printf HTMLI "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
530  printf HTML "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'});  printf HTMLI "  <title>%s</title>\n", $config{'title'};
531    print HTMLI " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">";
532  print HTML $border_head;  printf HTMLI "</head>\n<body>\n";
533  print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n";  printf HTMLI "<h1>%s</h1>\n", $config{'title'};
534  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";
535    printf HTMLI "<p>There are %d pages to translate.</p>\n",($wml{'english'}+$untranslated{'english'});
536    
537    # print HTMLI $border_head;
538    print HTMLI "<table summary=\"Translation Statistics by Page Count\" class=\"stattrans\">\n";
539    print HTMLI "<colgroup width=\"20%\">\n";
540    print HTMLI "<col>\n";
541    print HTMLI "</colgroup>";
542    print HTMLI "<colgroup width=\"10%\">\n";
543    print HTMLI "<col width=\"10%\">\n";
544    print HTMLI "<col width=\"10%\">\n";
545    print HTMLI "<col width=\"10%\">\n";
546    print HTMLI "<col width=\"10%\">\n";
547    print HTMLI "<col width=\"10%\">\n";
548    print HTMLI "<col width=\"10%\">\n";
549    print HTMLI "<col width=\"10%\">\n";
550    print HTMLI "<col width=\"10%\">\n";
551    print HTMLI "</colgroup>";
552    print HTMLI "<thead>";
553    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";
554    print HTMLI "</thead>";
555    print HTMLI "<tbody>";
556  foreach $lang (@search_in) {  foreach $lang (@search_in) {
557      my @processed_langs = ($langs{$lang});      my @processed_langs = ($langs{$lang});
558      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
# Line 457  foreach $lang (@search_in) { Line 562  foreach $lang (@search_in) {
562          $color_o = get_color (100 - $percent_o{$lang});          $color_o = get_color (100 - $percent_o{$lang});
563          $color_u = get_color (100 - $percent_u{$lang});          $color_u = get_color (100 - $percent_u{$lang});
564    
565          print HTML "<tr>";          print HTMLI "<tr>";
566          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;
567          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};
568          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};
569          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};
570          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};
571          print HTML "</tr>\n";          print HTMLI "</tr>\n";
572      }      }
573  }  }
574  print HTML "</table>\n";  print HTMLI "</tbody>";
575  print HTML $border_foot;  print HTMLI "</table>\n";
576    # print HTMLI $border_foot;
577    
578    print HTMLI "<h2>Translated web pages (by size)</h2>\n";
579    printf HTMLI "<p>There are %d bytes to translate.</p>\n",($wml_s{'english'}+$untranslated_s{'english'});
580    
581    # print HTMLI $border_head;
582    print HTMLI "<table summary=\"Translation Statistics by Page Size\" class=\"stattrans\">\n";
583    # print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n";
584    print HTMLI "<colgroup span=\"1\">\n";
585    print HTMLI "<col width=\"20%\">\n";
586    print HTMLI "</colgroup>";
587    print HTMLI "<colgroup span=\"8\">\n";
588    print HTMLI "<col width=\"13%\">\n";
589    print HTMLI "<col width=\"7%\">\n";
590    print HTMLI "<col width=\"13%\">\n";
591    print HTMLI "<col width=\"7%\">\n";
592    print HTMLI "<col width=\"13%\">\n";
593    print HTMLI "<col width=\"7%\">\n";
594    print HTMLI "<col width=\"13%\">\n";
595    print HTMLI "<col width=\"7%\">\n";
596    print HTMLI "</colgroup>";
597    print HTMLI "<thead>";
598    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";
599    print HTMLI "</thead>";
600    print HTMLI "<tbody>";
601    
602  print HTML "<h2>Translated templates (gettext files)</h2>\n";  foreach $lang (@search_in) {
603  printf HTML "<p>There are %d strings to translate.</p>\n",$po_total{'total'};      my @processed_langs = ($langs{$lang});
604  print HTML $border_head;      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
605  print HTML "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n";      foreach $l (@processed_langs) {
606  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";          $color_a = get_color ($percent_a{$lang});
607            $color_t = get_color ($percent_t{$lang});
608            $color_o = get_color (100 - $percent_o{$lang});
609            $color_u = get_color (100 - $percent_u{$lang});
610    
611            print HTMLI "<tr>";
612            printf HTMLI "<th><a href=\"%s.html\">%s</a> (%s)</th>", $l, ucfirst $lang, $l;
613            printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_a, $wml_s{$lang},                   $percent_as{$lang};
614            printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_t, $translated_s{$lang},            $percent_ts{$lang};
615            printf HTMLI "<td style=\"background-color: %s\">%d</td><td>(%.1f%%)</td>", $color_o, $outdated_s{$lang},              $percent_os{$lang};
616            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};
617            print HTMLI "</tr>\n";
618        }
619    }
620    print HTMLI "</tbody>";
621    print HTMLI "</table>\n";
622    # print HTMLI $border_foot;
623    
624    print HTMLI "<h2>Translated templates (gettext files)</h2>\n";
625    printf HTMLI "<p>There are %d strings to translate.</p>\n",$po_total{'total'};
626    # print HTMLI $border_head;
627    print HTMLI "<table summary=\"Gettext Translation Statistiks\"class=\"stattrans\">\n";
628    # print HTMLI "<table width=\"100%\" border=0 bgcolor=\"#cdc9c9\">\n";
629    print HTMLI "<colgroup span=\"1\"width=\"28%\">\n";
630    print HTMLI "</colgroup>";
631    print HTMLI "<colgroup span=\"6\" width=\"12%\">\n";
632    print HTMLI "<col width=\"12%\">\n";
633    print HTMLI "<col width=\"12%\">\n";
634    print HTMLI "<col width=\"12%\">\n";
635    print HTMLI "<col width=\"12%\">\n";
636    print HTMLI "<col width=\"12%\">\n";
637    print HTMLI "<col width=\"12%\">\n";
638    print HTMLI "</colgroup>";
639    print HTMLI "<thead>";
640    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";
641    print HTMLI "</thead>";
642    print HTMLI "<tbody>";
643  foreach $lang (@search_in) {  foreach $lang (@search_in) {
644      next if $lang eq 'english';      next if $lang eq 'english';
645      my @processed_langs = ($langs{$lang});      my @processed_langs = ($langs{$lang});
646      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";      @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh";
647      foreach $l (@processed_langs) {      foreach $l (@processed_langs) {
648          print HTML "<tr>";          print HTMLI "<tr>";
649          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;
650          $color_t = get_color ($percent_po_t{'total'}{$lang});          $color_t = get_color ($percent_po_t{'total'}{$lang});
651          $color_f = get_color (100 - $percent_po_f{'total'}{$lang});          $color_f = get_color (100 - $percent_po_f{'total'}{$lang});
652          $color_u = get_color (100 - $percent_po_u{'total'}{$lang});          $color_u = get_color (100 - $percent_po_u{'total'}{$lang});
653          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};
654          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};
655          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};
656          print HTML "</tr>\n";          print HTMLI "</tr>\n";
657      }      }
658  }  }
659    
660  print HTML "</table>\n";  print HTMLI "</tbody>";
661  print HTML $border_foot;  print HTMLI "</table>\n";
662    # print HTMLI $border_foot;
663  print HTML "<p><hr noshade size=1 width=\"100%\">\n";  
664  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";
665  print HTML "</body></html>\n";  print HTMLI "<p>Created with <a href=\"http://cvs.debian.org/webwml/stattrans.pl?cvsroot=webwml\">webwml-stattrans</a> at $date\n";
666  close (HTML);  print HTMLI "</body></html>\n";
667    close (HTMLI);
668    
669  print "done.\n" if ($config{'verbose'});  print "done.\n" if ($config{'verbose'});
670    

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.81

  ViewVC Help
Powered by ViewVC 1.1.5