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

Re: [PATCH] translation-check seems broken



On Mon, Jun 18, 2001 at 01:26:57AM +0200, Josip Rodin wrote:
> On Sat, Jun 16, 2001 at 01:21:13AM +0200, Denis Barbier wrote:
> > > while looking for distrib/vendors, i found that
> > >     http://www.debian.org/distrib/vendors.fr.html
> > > is broken, and it seems due to wml::debian::translation-check
> > > Patch attached.
> > 
> > Hmmm, looks like i need some rest, this bug had already been fixed (in a
> > slightly different manner), a sticky tag was around :(
> > But it would be nice to rebuild the whole site, since some pages are
> > still broken (e.g. the one above, and see also #100816).
> 
> Uh, I just rebuilt one of those broken pages and it still has some crap in
> it, see http://www.debian.org/Bugs/index.ko.html

Indeed, here is a fix which seems to work.

Denis
Index: translation-check.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/template/debian/translation-check.wml,v
retrieving revision 1.46
diff -u -r1.46 translation-check.wml
--- translation-check.wml	2001/06/03 20:01:11	1.46
+++ translation-check.wml	2001/06/18 06:37:41
@@ -32,7 +32,7 @@
 
 # This is the message that is displayed if the translation is aged.
 # (min_delta <= difference < max_delta)
-<define-tag translationaged whitespace=delete>
+<define-tag translationaged>
   [EN:<P><EM>Note:</EM> The original is newer than this translation.</P>:]
   [EL:<P><EM>Óçìåßùóç:</EM> To áõèåíôéêü åßíáé íåþôåñï áðï áõôÞ ôç ìåôÜöñáóç.</P>:]
   [SV:<P><EM>Observera:</EM> Originalet är nyare än denna översättning.</P>:]
@@ -60,9 +60,7 @@
 
 # This is the message that is displayed if the translation is too old.
 # (difference >= max_delta)
-<define-tag translationoutofdate whitespace=delete>
-<perl>
-my $slices = q{
+<define-tag translationoutofdate>
   [EN:<P><STRONG>Warning! This translation is too out of date,
       please see the <A HREF="$link">original</A>.</STRONG></P>:]
   [AR:<P><STRONG>Warning! This translation is too out of date,
@@ -109,15 +107,11 @@
       please see the <A HREF="$link">original</A>.</STRONG></P>:]
   [ZH:<p><strong>ª`·N¡I¦¹ºô­¶¤¤¤åĶ¥»¤Ó¤[¨S¦³§ó·s¤F¡A\
       ½Ð°Ñ¾\\<a href="$link">³Ì·s­ì­^¤å¥»</a>¡C</strong></p>:]
-};
-<perl:var> =~ s/([^:][^ \]])\n/$1 \n/g;
-<perl:print:var>
-</perl>
 </define-tag>
 
 # This is the message that is displayed if the referenced original file
 # no longer exists.
-<define-tag originalgone whitespace=delete>
+<define-tag originalgone>
   [EN:<P><EM>Note:</EM> The original no longer exists.</P>:]
   [AR:<P><EM>Note:</EM> The original no longer exists.</P>:]
   [DA:<P><EM>Bemærk:</EM> Originalen findes ikke længere.</P>:]
@@ -152,7 +146,7 @@
 # Input parameters:
 my ($translation, $file, $original, $mindelta, $maxdelta) = @_;
 
-my $parents, $level, $relative_dir;
+my $parents, $level, $relative_dir, $output;
 my @relative_dir = ();
 
 # This is the maximum difference between a translated
@@ -223,18 +217,27 @@
 
 print "Comparing original $version to translation version $translation\n" if ($debug >= 1);
 
+$output = '';
 if ($version eq "")
 {
-	print qq(<originalgone>)
+	$output = qq(<originalgone>)
 }
 elsif ( $major_number != $major_translated_number ) {
-	print qq(<translationoutofdate>)
+	$output = qq(<translationoutofdate>)
 }
 elsif ( $last_number - $last_translated_number >= $max_versions ) {
-	print qq(<translationoutofdate>)
+	$output = qq(<translationoutofdate>)
 }
 elsif ( $last_number - $last_translated_number >= $min_versions ) {
-	print qq(<translationaged>)
+	$output = qq(<translationaged>)
+}
+# Remove extra whitespace
+if ($output ne "") {
+	$output =~ s/^ +//m;
+	$output =~ s/ +$//m;
+	$output =~ s/:\]\n\[/:\]\[/sg;
+	$output =~ s/\n/ /sg;
+	print $output;
 }
 }
 </perl>

Reply to: