Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Locale-Maketext-Lexicon CPAN distribution.

Report information
The Basics
Id: 14701
Status: resolved
Priority: 0/
Queue: Locale-Maketext-Lexicon

People
Owner: Nobody in particular
Requestors: steve.hay [...] uk.radan.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.49
Fixed in: (no value)



Subject: xgettext doesn't handle interpolating functions
I'm running perl-5.8.7 on Windows XP. If I place the following in "foo.pm": print loc('Source: %1 line %2', $self->file(), $self->line()); and then run "xgettext foo.pm" then I get a "messages.po" file containing the msgid/msgstr pair: #: foo.pm:1 #. ($self->file() msgid "Source: %1 line %2" msgstr "" I would have expected the above to be: #: foo.pm:1 #. ($self->file(), $self->line()) msgid "Source: %1 line %2" msgstr "" The difference is only a comment, so it doesn't break anything, but it would be helpful if all the things being interpolated were correctly listed in the comment. It seems to have got confused over the () syntax in the method call. If I change "foo.pm" to read: print loc('Source: %1 line %2', $self->file, $self->line); then I get the expected output: #: foo.pm:1 #. ($self->file, $self->line) msgid "Source: %1 line %2" msgstr "" Perhaps it sees the closing ")" in "$self->file()" as the end of the "loc(...)" expression?
On Thu Sep 22 07:02:32 2005, SHAY wrote: Show quoted text
> I'm running perl-5.8.7 on Windows XP. > > If I place the following in "foo.pm": > > print loc('Source: %1 line %2', $self->file(), $self->line()); > > and then run "xgettext foo.pm" then I get a "messages.po" file > containing the msgid/msgstr pair: > > #: foo.pm:1 > #. ($self->file() > msgid "Source: %1 line %2" > msgstr "" > > I would have expected the above to be: > > #: foo.pm:1 > #. ($self->file(), $self->line()) > msgid "Source: %1 line %2" > msgstr "" > > The difference is only a comment, so it doesn't break anything, but it > would be helpful if all the things being interpolated were correctly > listed in the comment. > > It seems to have got confused over the () syntax in the method call. > If I change "foo.pm" to read: > > print loc('Source: %1 line %2', $self->file, $self->line); > > then I get the expected output: > > #: foo.pm:1 > #. ($self->file, $self->line) > msgid "Source: %1 line %2" > msgstr "" > > Perhaps it sees the closing ")" in "$self->file()" as the end of the > "loc(...)" expression?
Hi Steve Well, it's only taken 3 years, but I've finally released a fix for this issue. I started trying to patch the Perl parser that we use in Locale::Maketext::Extract, but it made me realise that trying to parse Perl is hard :) So, instead, I've added a new parser plugin based on PPI, which should avoid most of the difficult to solve bugs in the existing Perl parser. That said, the existing parser is usually good-enough, and the PPI parser, while more accurate, is a lot slower. Anyway, it's there if you want to try it out, in version 0.77 - available shortly on a CPAN server near you. thanks Clint