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

Diff of /webwml/stattrans.pl

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

revision 1.5 by joy, Wed Jul 18 21:36:34 2001 UTC revision 1.6 by joy, Wed Jul 18 23:10:47 2001 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20  use POSIX qw(strftime);  use POSIX qw(strftime);
21    use Getopt::Std;
22    
23    $opt_h = "/org/www.debian.org/debian.org/devel/website/stats";
24    $opt_w = "/org/www.debian.org/webwml";
25    $opt_p = "*.wml";
26    $opt_t = "Website Translation Statistics";
27    $opt_v = 0;
28    getopts('hwptv');
29  %config = (  %config = (
30             'htmldir' => '/org/www.debian.org/debian.org/devel/website/stats', #fixme             'htmldir' => $opt_h,
31             #'htmldir' => '/home/users/joey/public_html/webwml/', #fixme             'wmldir'  => $opt_w,
32             #'wmldir'  => '/home/project/Debian/CVS/webwml', #fixme             'wmlpat'  => $opt_p,
33             'wmldir'  => '/org/www.debian.org/webwml', #fixme             'title'   => $opt_t,
34             'wmlpat'  => '*.wml',             'verbose' => $opt_v,
            'title'   => 'Website Translation Statistics',  
            'verbose' => 0,  
35             );             );
36    
37  $max_versions = 5;  $max_versions = 5;
38  $min_versions = 1;  $min_versions = 1;
39    
40  # from english/template/debian/languages.wml  # from english/template/debian/languages.wml
41  # Needs to be synced frequently  # TODO: Needs to be synced frequently or fixed so it's automatic
42  my %langs = ( english    => "en",  my %langs = ( english    => "en",
43                hellas     => "el",                hellas     => "el",
44                turkish    => "tr",                turkish    => "tr",
# Line 119  sub getwmlfiles Line 124  sub getwmlfiles
124      my $count = 0;      my $count = 0;
125      my $is_english = ($lang eq "english")?1:0;      my $is_english = ($lang eq "english")?1:0;
126      my $file, $v;      my $file, $v;
127        my $l = $langs{$lang};
128    
129      return if (! -d "$config{'wmldir'}/$lang");      return if (! -d "$config{'wmldir'}/$lang");
130      open (FIND, "$cmd|") || die "Can't read from $cmd";      open (FIND, "$cmd|") || die "Can't read from $cmd";
# Line 129  sub getwmlfiles Line 135  sub getwmlfiles
135          chomp;          chomp;
136          $file = substr ($_, $cutfrom);          $file = substr ($_, $cutfrom);
137          $file =~ s/\.wml$//;          $file =~ s/\.wml$//;
138          $wmlfiles{$langs{$lang}} .= " " . $file;          $wmlfiles{$l} .= " " . $file;
139          if ($is_english) {          if ($is_english) {
140              $version{"$lang/$file"} = get_cvs_version ("$config{'wmldir'}/$lang", "$file.wml");              $version{"$lang/$file"} = get_cvs_version ("$config{'wmldir'}/$lang", "$file.wml");
141          } else {          } else {
# Line 138  sub getwmlfiles Line 144  sub getwmlfiles
144          $count++;          $count++;
145      }      }
146      close (FIND);      close (FIND);
147      $wmlfiles{$langs{$lang}} .= " ";      $wmlfiles{$l} .= " ";
148      $wml{$langs{$lang}} = $count;      $wml{$l} = $count;
149  }  }
150    
151  sub get_color  sub get_color
# Line 196  getwmlfiles ('english'); Line 202  getwmlfiles ('english');
202  foreach $l (keys %langs) {  foreach $l (keys %langs) {
203      next if ($l eq "english");      next if ($l eq "english");
204      print "$l " if ($config{'verbose'});      print "$l " if ($config{'verbose'});
205      getwmlfiles ($l);      getwmlfiles ($l);
206  }  }
207  print "\n" if ($config{'verbose'});  print "\n" if ($config{'verbose'});
208    
# Line 231  foreach $lang (sort (keys %langs)) { Line 237  foreach $lang (sort (keys %langs)) {
237                  $untranslated{$lang}++;                  $untranslated{$lang}++;
238          }          }
239      }      }
240    
241        $translated{$lang} = $translated{$lang} - $outdated{$lang};
242    
243      $percent_a{$l} = $wml{$l}/$wml{en} * 100;      $percent_a{$l} = $wml{$l}/$wml{en} * 100;
244      $percent_t{$l} = $translated{$lang}/$wml{en} * 100;      $percent_t{$l} = $translated{$lang}/$wml{en} * 100;
245      $percent_o{$l} = $outdated{$lang}/$wml{en} * 100;      $percent_o{$l} = $outdated{$lang}/$wml{en} * 100;
# Line 289  printf HTML "<h1 align=center>%s</h1>\n" Line 298  printf HTML "<h1 align=center>%s</h1>\n"
298    
299  print HTML $border_head;  print HTML $border_head;
300  print HTML "<table width=100% border=0 bgcolor=\"#cdc9c9\">\n";  print HTML "<table width=100% border=0 bgcolor=\"#cdc9c9\">\n";
301  print HTML "<tr><th>Language</th><th>Translated</th><th>Up to date</th><th>Outdated</th><th>Not translated</th></tr>\n";  print HTML "<tr><th>Language</th><th>Files</th><th>Up to date</th><th>Outdated</th><th>Not translated</th></tr>\n";
302  foreach $lang (sort (keys %langs)) {  foreach $lang (sort (keys %langs)) {
303      $l = $langs{$lang};      $l = $langs{$lang};
304    
# Line 298  foreach $lang (sort (keys %langs)) { Line 307  foreach $lang (sort (keys %langs)) {
307      print HTML "<tr>";      print HTML "<tr>";
308      printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, $lang, $l;      printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, $lang, $l;
309      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color, $wml{$l}, $percent_a{$l};      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color, $wml{$l}, $percent_a{$l};
310      printf HTML "<td align=right>%d (%d%%)</td>", $translated{$lang}, $percent_t{$l};      if ($l ne "en") {
311      printf HTML "<td align=right>%d (%d%%)</td>", $outdated{$lang}, $percent_o{$l};        printf HTML "<td align=right>%d (%d%%)</td>", $translated{$lang}, $percent_t{$l};
312      printf HTML "<td align=right>%d (%d%%)</td>", $untranslated{$lang}, $percent_u{$l};        printf HTML "<td align=right>%d (%d%%)</td>", $outdated{$lang}, $percent_o{$l};
313          printf HTML "<td align=right>%d (%d%%)</td>", $untranslated{$lang}, $percent_u{$l};
314        } else {
315          print HTML "<td>-</td><td>-</td><td>-</td>";
316        }
317      print HTML "</tr>\n",      print HTML "</tr>\n",
318  }  }
319    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.5