Commit 5f2503f7 authored by Dietmar Maurer's avatar Dietmar Maurer

support multiple gettext calls on one line

parent cc4b3384
...@@ -50,26 +50,31 @@ $href->{''} = $po; ...@@ -50,26 +50,31 @@ $href->{''} = $po;
sub extract_msg { sub extract_msg {
my ($filename, $linenr, $line) = @_; my ($filename, $linenr, $line) = @_;
my $count = 0;
while(1) {
my $text; my $text;
if ($line =~ m/\Wgettext\s*\("((?:[^"\\]++|\\.)*+)"\)/) { if ($line =~ m/\Wgettext\s*\((("((?:[^"\\]++|\\.)*+)")|('((?:[^'\\]++|\\.)*+)'))\)/g) {
$text = $1; $text = $3 || $5;
} elsif ($line =~ m/\Wgettext\s*\('((?:[^'\\]++|\\.)*+)'\)/) {
$text = $1;
} else {
die "can't extract gettext message in '$filename' line $linenr\n";
} }
last if !$text;
$count++;
my $ref = "$filename:$linenr"; my $ref = "$filename:$linenr";
if (my $po = $href->{$text}) { if (my $po = $href->{$text}) {
$po->reference($po->reference() . " $ref"); $po->reference($po->reference() . " $ref");
return; } else {
}
my $po = new Locale::PO(-msgid=> $text, -reference=> $ref, -msgstr=> ''); my $po = new Locale::PO(-msgid=> $text, -reference=> $ref, -msgstr=> '');
$href->{$text} = $po; $href->{$text} = $po;
} }
};
die "can't extract gettext message in '$filename' line $linenr\n"
if !$count;
}
foreach my $s (@$sources) { foreach my $s (@$sources) {
open(SRC, $s) || die "unable to open file '$s' - $!\n"; open(SRC, $s) || die "unable to open file '$s' - $!\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment