[Po4a-commits] po4a/lib/Locale/Po4a Po.pm,1.40,1.41 TransTractor.pm,1.63,1.64
Nicolas FRAN??OIS
po4a-devel@lists.alioth.debian.org
Sun, 03 Apr 2005 21:15:26 +0000
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv28710/lib/Locale/Po4a
Modified Files:
Po.pm TransTractor.pm
Log Message:
Fix possible issues when strings are evaluated to false.
The fix in Transtractor is no more needed.
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- Po.pm 2 Apr 2005 23:05:02 -0000 1.40
+++ Po.pm 3 Apr 2005 21:15:22 -0000 1.41
@@ -102,7 +102,7 @@
$self->initialize();
my $filename = shift;
- $self->read($filename) if defined($filename) && $filename;
+ $self->read($filename) if defined($filename) && length($filename);
return $self;
}
@@ -234,7 +234,7 @@
}
print $fh "".format_comment(unescape_text($self->{header_comment}),"")
- if $self->{header_comment};
+ if defined($self->{header_comment}) && length($self->{header_comment});
print $fh "msgid \"\"\n";
print $fh "msgstr ".quote_text($self->{header})."\n\n";
@@ -253,19 +253,24 @@
}
$output .= format_comment($self->{po}{$msgid}{'comment'},"")
- if $self->{po}{$msgid}{'comment'};
- if ($self->{po}{$msgid}{'automatic'}) {
+ if defined($self->{po}{$msgid}{'comment'})
+ && length ($self->{po}{$msgid}{'comment'});
+ if ( defined($self->{po}{$msgid}{'automatic'})
+ && length ($self->{po}{$msgid}{'automatic'})) {
foreach my $comment (split(/\\n/,$self->{po}{$msgid}{'automatic'}))
{
$output .= format_comment($comment, ". ")
}
}
$output .= format_comment($self->{po}{$msgid}{'type'}," type: ")
- if $self->{po}{$msgid}{'type'};
+ if defined($self->{po}{$msgid}{'type'})
+ && length ($self->{po}{$msgid}{'type'});
$output .= format_comment($self->{po}{$msgid}{'reference'},": ")
- if $self->{po}{$msgid}{'reference'};
+ if defined($self->{po}{$msgid}{'reference'})
+ && length ($self->{po}{$msgid}{'reference'});
$output .= "#, ". join(", ", sort split(/\s+/,$self->{po}{$msgid}{'flags'}))."\n"
- if $self->{po}{$msgid}{'flags'};
+ if defined($self->{po}{$msgid}{'flags'})
+ && length ($self->{po}{$msgid}{'flags'});
$output .= "msgid ".quote_text($msgid)."\n";
$output .= "msgstr ".quote_text($self->{po}{$msgid}{'msgstr'})."\n";
Index: TransTractor.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TransTractor.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- TransTractor.pm 2 Apr 2005 21:57:12 -0000 1.63
+++ TransTractor.pm 3 Apr 2005 21:15:22 -0000 1.64
@@ -856,10 +856,6 @@
}
}
- if (! defined($options{'comment'})) {
- $options{'comment'} = "";
- }
-
# the comments provided by the modules are automatic comments from the PO point of view
$self->{TT}{po_out}->push('msgid' => $string,
'reference' => $ref,