Fixed wmlxgettext so that it understands escaped quotes.

This commit is contained in:
Guillaume Melquiond 2009-07-19 12:02:09 +00:00
parent c100cd0525
commit 0c85a3a440
2 changed files with 4 additions and 3 deletions

View file

@ -77,6 +77,7 @@ sub stripfromwml {
sub raw2postring {
my $str = shift;
$str =~ s/\"\"/\\\"/mg;
$str =~ s/^(.*)$/"$1\\n"/mg;
$str =~ s/\n$/\n"\\n"/mg;
$str =~ s/\\n\"$/\"\n/g;

View file

@ -58,7 +58,7 @@ foreach my $file (@ARGV) {
# skip other # lines as comments
next LINE if m/^\s*\#/ and !defined $str;
if (!defined $str and m/^(?:[^\"]*?)((?:_\s*)?)\"([^\"]*)\"(.*)/) {
if (!defined $str and m/^(?:[^\"]*?)((?:_\s*)?)\"([^\"]*(?:\"\"[^\"]*)*)\"(.*)/) {
# single-line quoted string
$translatable = ($1 ne '');
@ -79,7 +79,7 @@ foreach my $file (@ARGV) {
$_ = $rest . "\n";
redo LINE;
} elsif (!defined $str and m/^(?:[^\"]*?)((?:_\s*)?)\s*\"([^\"]*)/) {
} elsif (!defined $str and m/^(?:[^\"]*?)((?:_\s*)?)\s*\"([^\"]*(?:\"\"[^\"]*)*)/) {
# start of multi-line
$translatable = ($1 ne '');
@ -88,7 +88,7 @@ foreach my $file (@ARGV) {
$str = $_;
$line = $.;
} elsif (m/(.*?)\"(.*)/) {
} elsif (m/([^\"]*(?:\"\"[^\"]*)*)\"(.*)/) {
# end of multi-line
die "end of string without a start in $file" if !defined $str;