[Po4a-commits] r2716 - in /trunk: lib/Locale/Po4a/Ini.pm t/data-26/test1.po
barbier at users.alioth.debian.org
barbier at users.alioth.debian.org
Sat Jan 5 09:47:24 UTC 2013
Author: barbier
Date: Sat Jan 5 09:47:24 2013
New Revision: 2716
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2716
Log:
Ini: Include key parameter as an automatic comment
Based on a report and patch by Didier Raboud, thanks.
See http://bugs.debian.org/696992
Modified:
trunk/lib/Locale/Po4a/Ini.pm
trunk/t/data-26/test1.po
Modified: trunk/lib/Locale/Po4a/Ini.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/lib/Locale/Po4a/Ini.pm?rev=2716&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/Ini.pm (original)
+++ trunk/lib/Locale/Po4a/Ini.pm Sat Jan 5 09:47:24 2013
@@ -43,26 +43,23 @@
if ($line =~ /\"/) {
print STDERR "Start of line containing \".\n" if $debug;
# Text before the first quote
- $line =~ m/(^[^"\r\n]*")/;
+ $line =~ m/(^[^"\r\n]*)"/;
my $pre_text = $1;
print STDERR " PreText=".$pre_text."\n" if $debug;
# The text for translation
- $line =~ m/("[^\r\n]*")/;
+ $line =~ m/"([^\r\n]*)"/;
my $quoted_text = $1;
print STDERR " QuotedText=".$quoted_text."\n" if $debug;
# Text after last quote
- $line =~ m/("[^"\n]*$)/;
+ $line =~ m/"([^"\n]*$)/;
my $post_text = $1;
print STDERR " PostText=".$post_text."\n" if $debug;
- # Remove starting and ending quotes from the translation text, if any
- $quoted_text =~ s/^"//g;
- $quoted_text =~ s/"$//g;
# Translate the string it
- $par = $self->translate($quoted_text, $ref);
+ $par = $self->translate($quoted_text, $ref, $pre_text);
# Escape the \n characters
$par =~ s/\n/\\n/g;
# Now push the result
- $self->pushline($pre_text.$par.$post_text."\n");
+ $self->pushline($pre_text.'"'.$par.'"'.$post_text."\n");
print STDERR "End of line containing \".\n" if $debug;
}
else
Modified: trunk/t/data-26/test1.po
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-26/test1.po?rev=2716&op=diff
==============================================================================
--- trunk/t/data-26/test1.po (original)
+++ trunk/t/data-26/test1.po Sat Jan 5 09:47:24 2013
@@ -15,16 +15,19 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING"
+#. type: key1=
#: ../data-26/test1.ini:2
#, no-wrap
msgid "some value"
msgstr ""
+#. type: key2=
#: ../data-26/test1.ini:3
#, no-wrap
msgid "some other value"
msgstr ""
+#. type: key4=
#: ../data-26/test1.ini:5
#, no-wrap
msgid "toto\\ttata\\ntutu"
More information about the Po4a-commits
mailing list