[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

stattrans.pl improvements



Howdy,

The first hunk of this patch calculates the percentages of
up-to-date and outdated pages relative to the number of pages
translated into that language, rather than the total number of
pages.

The first part of the second hunk inverts the colorization of the
outdated and untranslated pages so that they are green when things
are good (i.e., no outdated/untranslated page) and red when things
are bad.

The second part of second hunk eliminates the special case for
English so that its translation statistics are also displayed on
the index page.

You can see the results of these changes at
http://opensource.lineo.com/~kraai/stats/.  Are any/all of these
changes OK?

Unfixed by this patch, non-English originals with no English
translation are not included in any of the statistics.  I'm
planning to fix that.

Matt

Index: stattrans.pl
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.25
diff -u -r1.25 stattrans.pl
--- stattrans.pl	2001/09/07 21:46:20	1.25
+++ stattrans.pl	2001/09/10 16:16:14
@@ -261,8 +261,8 @@
     $translated{$lang} = $translated{$lang} - $outdated{$lang};
 
     $percent_a{$lang} = $wml{$lang}/$wml{english} * 100;
-    $percent_t{$lang} = $translated{$lang}/$wml{english} * 100;
-    $percent_o{$lang} = $outdated{$lang}/$wml{english} * 100;
+    $percent_t{$lang} = $translated{$lang}/$wml{$lang} * 100;
+    $percent_o{$lang} = $outdated{$lang}/$wml{$lang} * 100;
     $percent_u{$lang} = $untranslated{$lang}/$wml{english} * 100;
 
     if (open (HTML, ">$config{'htmldir'}/$l.html")) {
@@ -331,19 +331,15 @@
 
     $color_a = get_color ($percent_a{$lang});
     $color_t = get_color ($percent_t{$lang});
-    $color_o = get_color ($percent_o{$lang});
-    $color_u = get_color ($percent_u{$lang});
+    $color_o = get_color (100 - $percent_o{$lang});
+    $color_u = get_color (100 - $percent_u{$lang});
 
     print HTML "<tr>";
     printf HTML "<td><a href=\"%s.html\">%s</a> (%s)</td>", $l, ucfirst $lang, $l;
     printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_a, $wml{$lang}, $percent_a{$lang};
-    if ($l ne "en") {
-      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang};
-      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang};
-      printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang};
-    } else {
-      print HTML "<td bgcolor=\"#00FF00\" align=right>-</td><td bgcolor=\"#00FF00\" align=right>-</td><td bgcolor=\"#FF0000\" align=right>-</td>";
-    }
+    printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_t, $translated{$lang}, $percent_t{$lang};
+    printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_o, $outdated{$lang}, $percent_o{$lang};
+    printf HTML "<td bgcolor=\"%s\" align=right>%d (%d%%)</td>", $color_u, $untranslated{$lang}, $percent_u{$lang};
     print HTML "</tr>\n",
 }
 



Reply to: