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;
sub extract_msg {
my ($filename, $linenr, $line) = @_;
my $text;
if ($line =~ m/\Wgettext\s*\("((?:[^"\\]++|\\.)*+)"\)/) {
$text = $1;
} elsif ($line =~ m/\Wgettext\s*\('((?:[^'\\]++|\\.)*+)'\)/) {
$text = $1;
} else {
die "can't extract gettext message in '$filename' line $linenr\n";
}
my $count = 0;
my $ref = "$filename:$linenr";
while(1) {
my $text;
if ($line =~ m/\Wgettext\s*\((("((?:[^"\\]++|\\.)*+)")|('((?:[^'\\]++|\\.)*+)'))\)/g) {
$text = $3 || $5;
}
last if !$text;
if (my $po = $href->{$text}) {
$po->reference($po->reference() . " $ref");
return;
}
$count++;
my $po = new Locale::PO(-msgid=> $text, -reference=> $ref, -msgstr=> '');
$href->{$text} = $po;
}
my $ref = "$filename:$linenr";
if (my $po = $href->{$text}) {
$po->reference($po->reference() . " $ref");
} else {
my $po = new Locale::PO(-msgid=> $text, -reference=> $ref, -msgstr=> '');
$href->{$text} = $po;
}
};
die "can't extract gettext message in '$filename' line $linenr\n"
if !$count;
}
foreach my $s (@$sources) {
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