[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 09:05:46AM +0200, Gerfried Fuchs wrote:
>  I think there must be a bug in the recent stattrans.pl updates.  If you
> look e.g. at the de.html you will notice that the version of e.g.
> international/Chinese/index for english is considered as 1.15, which
> simply isn't true.  It's just 1.6.  The diff also points to the
> chinese/international/Chinese/index page.
> 
>  This seems to happen for pages that don't have an english orgiginal.
> Although that might be useful for some people it's blatantly wrong.  The
> translation-check in the german version doesn't refer to the chinese
> english version - and therefore shouldn't be chacked against the chinese
> version but the english one!
> 
>  The same applies to the finnish, polish, romanian and spanish pages.
> Could someone pretty please revert the changes that caused that so we
> can work on as usual?

It appears that stattrans.pl has no concept of the same file
having multiple origins (i.e., German depends on English which
depends on Romanian).

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?

Matt

Index: stattrans.pl
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.24
diff -c -3 -p -r1.24 stattrans.pl
*** stattrans.pl	2001/09/03 23:48:35	1.24
--- stattrans.pl	2001/09/07 19:16:23
*************** $border_foot = "</td></tr></table></td><
*** 85,90 ****
--- 85,92 ----
  $date = strftime "%a %b %e %H:%M:%S %Y %z", localtime;
  
  my %original;
+ my %transversion;
+ my %version;
  
  # Count wml files in given directory
  #
*************** sub getwmlfiles
*** 113,132 ****
  	$file =~ s/\.wml$//;
  	$wmlfiles{$lang} .= " " . $file;
  	my $transcheck = Webwml::TransCheck->new("$dir/$file.wml");
! 	if ($is_english) {
! 	    if ($original{$file}) {
! 	        $version{"$lang/$file"} = $transcheck->revision();
! 	    } else {
! 	        $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"} ||= "1.1";
  	$count++;
--- 115,128 ----
  	$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 ($lang eq "english") {
! 	    $version{"$lang/$file"} = $cvs->revision($f);
  	} else {
! 	    $version{"$lang/$file"} = $altcvs->revision($f);
  	}
  	$version{"$lang/$file"} ||= "1.1";
  	$count++;
*************** foreach $lang (@search_in) {
*** 225,233 ****
  		    	$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file;
  		}
  		$translated{$lang}++;
! 		$orig = $original{$file} || "english";
  		# Outdated translations
! 		$msg = check_translation ($version{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
  		if (length ($msg)) {
  			$o_body .= "<tr>";
  			if ($file eq "devel/wnpp/wnpp") {
--- 221,229 ----
  		    	$t_body .= sprintf "<a href=\"/%s.%s.html\">%s</a><br>\n", $file, $l, $file;
  		}
  		$translated{$lang}++;
! 		$orig = $original{"$lang/$file"} || "english";
  		# Outdated translations
! 		$msg = check_translation ($transversion{"$lang/$file"}, $version{"$orig/$file"}, "$lang/$file");
  		if (length ($msg)) {
  			$o_body .= "<tr>";
  			if ($file eq "devel/wnpp/wnpp") {
*************** foreach $lang (@search_in) {
*** 235,244 ****
  			} 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>", $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 .= "</tr>\n";
      			$outdated{$lang}++;
  		}
--- 231,240 ----
  			} else {
  				$o_body .= sprintf "<td><a href=\"/%s.%s.html\">%s</a></td>", $file, $l, $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, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $config{'diff_type'}, $transversion{"$lang/$file"}, $version{"$orig/$file"};
  			$o_body .= "</tr>\n";
      			$outdated{$lang}++;
  		}



Reply to: