[Po4a-commits] "po4a/lib/Locale/Po4a Po.pm,1.93,1.94"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Sat Jan 31 19:04:48 UTC 2009
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv1006/lib/Locale/Po4a
Modified Files:
Po.pm
Log Message:
* lib/Locale/Po4a/Po.pm: Do not duplicate the references when the
same string has different translations
* lib/Locale/Po4a/Po.pm: Fix the conflict markers when more than 2
alternatives exist.
* lib/Locale/Po4a/Po.pm: Indicate the reference of the
translations when a conflict occurs during a gettextization
(instead of "choice").
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- Po.pm 12 Nov 2008 17:13:27 -0000 1.93
+++ Po.pm 31 Jan 2009 19:04:46 -0000 1.94
@@ -658,7 +658,8 @@
'flags' => $flags,
'type' => $typeorig,
'reference' => $reforig,
- 'conflict' => 1)
+ 'conflict' => 1,
+ 'transref' => $potrans->{po}{$trans}{'reference'})
unless (defined($pores->{po}{$orig})
and ($pores->{po}{$orig}{'msgstr'} eq $trans))
# FIXME: maybe we should be smarter about what reference should be
@@ -1164,10 +1165,10 @@
sub push_raw {
my $self=shift;
my %entry=@_;
- my ($msgid,$msgstr,$reference,$comment,$automatic,$flags,$type)=
+ my ($msgid,$msgstr,$reference,$comment,$automatic,$flags,$type,$transref)=
($entry{'msgid'},$entry{'msgstr'},
$entry{'reference'},$entry{'comment'},$entry{'automatic'},
- $entry{'flags'},$entry{'type'});
+ $entry{'flags'},$entry{'type'},$entry{'transref'});
my $keep_conflict = $entry{'conflict'};
# print STDERR "Push_raw\n";
@@ -1217,12 +1218,21 @@
quote_text($msgstr));
if ($keep_conflict) {
- $msgstr = "#-#-#-#-# choice #-#-#-#-#\\n".
- $self->{po}{$msgid}{'msgstr'}."\\n".
- "#-#-#-#-# choice #-#-#-#-#\\n".
- "$msgstr";
- $msgstr = "#-#-#-#-# choice #-#-#-#-#\\n".$msgstr
- unless ($msgstr =~ m/^#-#-#-#-# choice #-#-#-#-#\\n/s);
+ if ($self->{po}{$msgid}{'msgstr'} =~ m/^#-#-#-#-# .* #-#-#-#-#\\n/s) {
+ $msgstr = $self->{po}{$msgid}{'msgstr'}.
+ "\\n#-#-#-#-# $transref #-#-#-#-#\\n".
+ $msgstr;
+ } else {
+ $msgstr = "#-#-#-#-# ".
+ $self->{po}{$msgid}{'transref'}.
+ " #-#-#-#-#\\n".
+ $self->{po}{$msgid}{'msgstr'}."\\n".
+ "#-#-#-#-# $transref #-#-#-#-#\\n".
+ $msgstr;
+ }
+ # Every msgid will have the same list of references.
+ # Only keep the last list.
+ $self->{po}{$msgid}{'reference'} = "";
} else {
warn wrap_msg(dgettext("po4a",
"Translations don't match for:\n".
@@ -1236,6 +1246,9 @@
}
}
}
+ if (defined $transref) {
+ $self->{po}{$msgid}{'transref'} = $transref;
+ }
if (defined $reference) {
if (defined $self->{po}{$msgid}{'reference'}) {
$self->{po}{$msgid}{'reference'} .= " ".$reference;
More information about the Po4a-commits
mailing list