[Po4a-commits] r2541 - /trunk/lib/Locale/Po4a/Po.pm
barbier-guest at users.alioth.debian.org
barbier-guest at users.alioth.debian.org
Thu Feb 23 20:52:08 UTC 2012
Author: barbier-guest
Date: Thu Feb 23 20:52:07 2012
New Revision: 2541
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2541
Log:
Preserve obsolete entries (prefixed by #~) in read()+write() cycle
Modified:
trunk/lib/Locale/Po4a/Po.pm
Modified: trunk/lib/Locale/Po4a/Po.pm
URL: http://svn.debian.org/wsvn/po4a/trunk/lib/Locale/Po4a/Po.pm?rev=2541&op=diff
==============================================================================
--- trunk/lib/Locale/Po4a/Po.pm (original)
+++ trunk/lib/Locale/Po4a/Po.pm Thu Feb 23 20:52:07 2012
@@ -201,6 +201,7 @@
"Content-Transfer-Encoding: 8bit\n");
$self->{encoder}=find_encoding("ascii");
+ $self->{footer}=[];
# To make stats about gettext hits
$self->stats_clear();
@@ -251,6 +252,10 @@
foreach my $msg (split (/\n\n/,$pofile)) {
my ($msgid,$msgstr,$comment,$previous,$automatic,$reference,$flags,$buffer);
my ($msgid_plural, $msgstr_plural);
+ if ($msg =~ m/^#~/m) {
+ push($self->{footer}, $msg);
+ next;
+ }
foreach my $line (split (/\n/,$msg)) {
$linenum++;
if ($line =~ /^#\. ?(.*)$/) { # Automatic comment
@@ -476,6 +481,8 @@
print $fh $output;
}
+ print $fh join("\n\n", @{$self->{footer}}) if scalar @{$self->{footer}};
+
# print STDERR "$fh";
# if ($filename ne '-') {
# close $fh
More information about the Po4a-commits
mailing list