tags 374463 patch
thanks
Thomas Huriaux <[EMAIL PROTECTED]> (20/06/2006):
> Thomas Huriaux <[EMAIL PROTECTED]> (19/06/2006):
> > There are two problems here:
> > 1. If you take for example the string
> > "What would you like to do about ${BASENAME}?"
> > it appears twice in templates.master (lines 10 and 18) while being
> > referenced only once in the po file with the following line:
> > #: ../templates.master:18
> >
> > This is a bug in intltool-extract, which uses hashes instead of
> > lists. When a string appears for the second time, it overrides the
> > definition of the first appearance.
> >
> > I'm not sure about how to fix it, so I'd prefer to have Denis'
> > opinion before trying to work on it.
>
> Here is a first patch (incomplete, waiting for Denis'comments to
> continue).
> With this we have the expected behavior, for example (ucf templates)
> #: ../templates.master:8 ../templates.master:16
> There is a bug, the comments are displayed twice, as following:
> #. Type: select
> #. Description
> #. // Type: select
> #. // DescriptionWith the attached patch, we now have: #. Type: select #. Choices #. --- #. Type: select #. Choices in the same order as the line #: ../templates.master:8 ../templates.master:16 > And last thing to do: to refer to a template number is probably better > (in order to know exactly which strings belong to the same template). I have no idea how to solve this issue. Cheers, -- Thomas Huriaux
--- /usr/share/intltool-debian/intltool-extract 2006-05-14 00:45:07.000000000
+0200
+++ intltool-extract 2006-06-20 14:38:32.000000000 +0200
@@ -709,9 +709,10 @@
$strcount++;
next if (exists($tfields[$cnt]) && $tfields[$cnt] != 1);
$messages{$str} = [];
- $loc{$str} = $lineno;
- $count{$str} = $strcount;
- $comments{$str} = $tag . $pocomments[$cnt];
+ push (@{$loc{$str}}, $lineno);
+ $count{$str} = $strcount unless defined $count{$str};
+ $comments{$str} .= "\n---\n" if defined $comments{$str};
+ $comments{$str} .= $tag . $pocomments[$cnt];
}
$lineno += ($text =~ s/\n//g);
}
@@ -890,7 +891,7 @@
{
@msgids = sort keys %messages;
}
- for my $message (@msgids)
+ LOOP: for my $message (@msgids)
{
my $offsetlines = 1;
$offsetlines++ if $message =~ /%/;
@@ -901,12 +902,12 @@
$offsetlines++;
}
}
- print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n"
+ print OUT "# ".($loc{$message}[0] - $offsetlines). " \"$FILE\"\n"
if defined $loc{$message};
if (defined ($comments{$message}))
{
- $comments{$message} =~ s,^,// ,mg;
- print OUT $comments{$message}."\n";
+ (my $tmp_comments = $comments{$message}) =~ s,^,// ,mg;
+ print OUT $tmp_comments."\n";
}
print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/;
@@ -933,6 +934,10 @@
print OUT "\");\n";
}
}
+ if (defined $loc{$message}) {
+ shift (@{$loc{$message}});
+ redo LOOP if @{$loc{$message}};
+ }
}
}
signature.asc
Description: Digital signature

