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
  #. // Description
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).

In my patch, I assume that %loc is only used with rfc822deb (which seems
to be true), so I took the liberty to change its content.

Cheers,


-- 
Thomas Huriaux
--- /usr/share/intltool-debian/intltool-extract 2006-05-14 00:45:07.000000000 
+0200
+++ intltool-extract    2006-06-20 00:49:54.000000000 +0200
@@ -709,7 +709,7 @@
             $strcount++;
             next if (exists($tfields[$cnt]) && $tfields[$cnt] != 1);
             $messages{$str} = [];
-            $loc{$str} = $lineno;
+            push (@{$loc{$str}}, $lineno);
             $count{$str} = $strcount;
             $comments{$str} = $tag . $pocomments[$cnt];
         }
@@ -890,7 +890,7 @@
     {
         @msgids = sort keys %messages;
     }
-    for my $message (@msgids)
+    LOOP: for my $message (@msgids)
     {
        my $offsetlines = 1;
        $offsetlines++ if $message =~ /%/;
@@ -901,7 +901,7 @@
                    $offsetlines++;
                }
        }
-       print OUT "# ".($loc{$message} - $offsetlines).  " \"$FILE\"\n"
+       print OUT "# ".($loc{$message}[0] - $offsetlines).  " \"$FILE\"\n"
                if defined $loc{$message};
        if (defined ($comments{$message}))
        {
@@ -933,6 +933,10 @@
                 print OUT "\");\n";  
            }
         }
+       if (defined $loc{$message}) {
+         shift (@{$loc{$message}});
+         redo LOOP if @{$loc{$message}};
+       }
     }
 }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to