[Po4a-devel][CVS] po4a po4a,1.6,1.7

Martin Quinson po4a-devel@lists.alioth.debian.org
Sun, 18 Jul 2004 06:42:42 +0000


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv9860

Modified Files:
	po4a 
Log Message:
DO NOT OUTPUT TO ARRAY(something), MORON; detect moron like me trying to overwrite their master file by giving their name as translation; display the name of the translation in the message instead of master

Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- po4a	18 Jul 2004 06:27:25 -0000	1.6
+++ po4a	18 Jul 2004 06:42:40 -0000	1.7
@@ -261,11 +261,15 @@
 	$document{$main}{'format'} = $1;	
 	foreach my $arg (split(/ /,$args)) {
 	    die sprintf("%s:%d: ".
+		        gettext("The translated and master file are the same."),
+		        $config_file,$nb)
+	      if ($main eq $2);
+	    die sprintf("%s:%d: ".
 		        gettext("Unparsable argument '%s'").
 		        "\n",
 	                $config_file,$nb,$arg)
 	      unless ($arg =~ /^([^:]*):(.*)/);
-	    push @{$document{$main}{$1}},$2;
+	    $document{$main}{$1} = $2;
 	}
 
     } else {
@@ -337,8 +341,8 @@
 	my ($percent,$hit,$queries) = $doc->stats();
 	
 	if ($percent<$threshold)  {
-	    print STDERR sprintf(gettext("Discard the translation of %s (only %s%% translated; need %s%%)."),
-		                 $master,$percent,$threshold)."\n";
+	    print STDERR sprintf(gettext("Discard the translation %s (only %s%% translated; need %s%%)."),
+		                 $document{$master}{$lang},$percent,$threshold)."\n";
 	    unlink($document{$master}{$lang}) if (-e $document{$master}{$lang});
 	    next LANG;
 	}
@@ -347,14 +351,14 @@
 	    foreach my $add ($document{$master}{"add_$lang"}) {
 		if ( !$doc->addendum($_) ) {
 		    die sprintf(gettext("Addendum %s does apply to %s (translation discarded)."),
-			$add,$master)."\n";
+			$add,$document{$master}{$lang})."\n";
 		    unlink($document{$master}{$lang}) if (-e $document{$master}{$lang});
 		    next LANG;
 		}
 	    }
 	}
 	print STDERR sprintf(gettext("%s is %s%% translated (%s of %s strings)."),
-	    $master,$percent,$hit,$queries)."\n" 
+	    $document{$master}{$lang},$percent,$hit,$queries)."\n" 
 	  if $verbose;
 
 	$doc->write($document{$master}{$lang});