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

Re: stattrans.pl seems to be broken!!



On Fri, Sep 07, 2001 at 01:34:01PM -0600, Matt Kraai wrote:
[...]
> The following patch changes it so that this will work.  It won't
> note that the German page is outdated if the English page falls
> behind the Romanian, but this seems to parallel the translation-
> check behavior.
> 
> I tested it on my system and it seemed sane.  OK to commit?

Hi Matt,

I have slighlty modified your patch (mine is attached, I added some
lines at the end of 2nd chunk) and already committed it, but feel free
to patch it again if necessary.

The reason is that some pages do not have wml::debian::translation-check,
e.g. {english,hungarian}/international/Hungarian.wml, and I believe it
is better to assume they have not been translated from English in such
cases.

Denis
Index: stattrans.pl
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.24
diff -u -r1.24 stattrans.pl
--- stattrans.pl	2001/09/03 23:48:35	1.24
+++ stattrans.pl	2001/09/07 21:18:47
@@ -85,6 +85,8 @@
 $date = strftime "%a %b %e %H:%M:%S %Y %z", localtime;
 
 my %original;
+my %transversion;
+my %version;
 
 # Count wml files in given directory
 #
@@ -113,20 +115,18 @@
 	$file =~ s/\.wml$//;
 	$wmlfiles{$lang} .= " " . $file;
 	my $transcheck = Webwml::TransCheck->new("$dir/$file.wml");
+	if ($transcheck->revision()) {
+	    $transversion{"$lang/$file"} = $transcheck->revision();
+	    $original{"$lang/$file"} ||= $transcheck->original();
+	}
 	if ($is_english) {
-	    if ($original{$file}) {
-	        $version{"$lang/$file"} = $transcheck->revision();
-	    } else {
-	        $version{"$lang/$file"} = $cvs->revision($f);
-	    }
+	    $version{"$lang/$file"} = $cvs->revision($f);
 	} else {
-	    if ($transcheck->revision()) {
-	        $version{"$lang/$file"} = $transcheck->revision();
-	        $original{$file} ||= $transcheck->original();
-	    } else {
-	        $version{"$lang/$file"} = $altcvs->revision($f);
-                $original{$file} = $lang;
-            }
+	    $version{"$lang/$file"} = $altcvs->revision($f);
+	    if (!$transcheck->revision()) {
+		$original{"english/$file"} = $lang;
+		$transversion{"english/$file"} = "1.1";
+	    }
 	}
 	$version{"$lang/$file"} ||= "1.1";
 	$count++;
@@ -134,7 +134,7 @@
     close (FIND);
     $wmlfiles{$lang} .= " ";
     $wml{$lang} = $count;
-}	  
+}
 
 sub get_color
 {
@@ -225,9 +225,9 @@
 		    	$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file;
 		}
 		$translated{$lang}++;
-		$orig = $original{$file} || "english";
+		$orig = $original{"$lang/$file"} || "english";
 		# Outdated translations
-		$msg = check_translation ($version{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
+		$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
 		if (length ($msg)) {
 			$o_body .= "<tr>";
 			if ($file eq "devel/wnpp/wnpp") {
@@ -235,10 +235,10 @@
 			} else {
 				$o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $file, $l, $file;
 			}
-			$o_body .= sprintf "<td>%s</td>", $version{"$lang/$file"};
+			$o_body .= sprintf "<td>%s</td>", $transversion{"$lang/$file"};
 			$o_body .= sprintf "<td>%s</td>", $version{"$orig/$file"};
 			$o_body .= sprintf "<td>%s</td>", $msg;
-			$o_body .= sprintf "<td>&nbsp;&nbsp;<a href=\"http://cvs.debian.org/webwml/$orig/%s.wml.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\";>%s -> %s</a></td>", $file, $version{"$lang/$file"}, $version{"$orig/$file"}, $config{'diff_type'}, $version{"$lang/$file"}, $version{"$orig/$file"};
+			$o_body .= sprintf "<td>&nbsp;&nbsp;<a href=\"http://cvs.debian.org/webwml/$orig/%s.wml.diff\?r1=%s\&r2=%s\&cvsroot=webwml\&diff_format=%s\";>%s -> %s</a></td>", $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $config{'diff_type'}, $transversion{"$lang/$file"}, $version{"$orig/$file"};
 			$o_body .= "</tr>\n";
     			$outdated{$lang}++;
 		}

Reply to: