Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv26491
Modified Files:
Dia.pm Man.pm Po.pm Sgml.pm Xml.pm
Log Message:
Try to share strings to translate between modules by moving the module name out of the
part to translate (sorry for the fuzzy).
Index: Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- Sgml.pm 7 Aug 2004 03:02:06 -0000 1.30
+++ Sgml.pm 7 Aug 2004 04:51:33 -0000 1.31
@@ -168,10 +168,7 @@
eval qq{use SGMLS};
if ($@) {
- die gettext(
- "po4a::sgml: The needed module SGMLS.pm was not found and needs to be\n".
- "po4a::sgml: installed. It can be found on the CPAN, in package\n".
- "po4a::sgml: libsgmls-perl on debian, etc.")."\n";
+ die "po4a::sgml: ".gettext("The needed module SGMLS.pm was not found and
needs to be installed. It can be found on the CPAN, in package libsgmls-perl on debian,
etc.")."\n";
}
use File::Temp;
@@ -203,7 +200,7 @@
foreach my $opt (keys %options) {
if ($options{$opt}) {
- die sprintf(gettext ("po4a::sgml: Unknown option: %s"),
$opt)."\n" unless exists $self->{options}{$opt};
+ die sprintf("po4a::sgml: ".gettext ("Unknown option: %s"),
$opt)."\n" unless exists $self->{options}{$opt};
$self->{options}{$opt} = $options{$opt};
}
}
@@ -237,14 +234,14 @@
# don't translate entries composed of one entity
if ( (($string =~ /^&[^;]*;$/) || ($options{'wrap'} && $string =~
/^\s*&[^;]*;\s*$/))
&& !($self->{options}{'include-all'}) ){
- warn sprintf(gettext("po4a::sgml: msgid skipped to help translators (contains only
an entity)"), $string)."\n"
+ warn sprintf("po4a::sgml: ".gettext("msgid skipped to help translators
(contains only an entity)"), $string)."\n"
unless $self->verbose() <= 0;
return $string;
}
# don't translate entries composed of tags only
if ( $string =~ /^(((<[^>]*>)|\s)*)$/
&& !($self->{options}{'include-all'}) ) {
- warn sprintf(gettext("po4a::sgml: msgid skipped to help translators (contains only
tags)"), $string)."\n"
+ warn sprintf("po4a::sgml: ".gettext("msgid skipped to help translators
(contains only tags)"), $string)."\n"
unless $self->verbose() <= 0;
return $string;
}
@@ -293,13 +290,12 @@
while (<IN>) {
$origfile .= $_;
}
- close IN || die sprintf(gettext("po4a::sgml: can't close %s:
%s"),$filename,$!)."\n";
+ close IN || die sprintf("po4a::sgml: ".gettext("can't close %s:
%s"),$filename,$!)."\n";
# Detect the XML pre-prolog
if ($origfile =~ s/^(\s*<\?xml[^?]*\?>)//) {
warn sprintf(gettext(
"po4a::sgml: Trying to handle a XML document as a SGML one.\n".
- "po4a::sgml: Feel lucky if it works, help us implementing a proper XML\n".
- "po4a::sgml: backend if it does not."),$filename)."\n"
+ "po4a::sgml: Feel lucky if it works, help us implementing a proper XML backend if
it does not."),$filename)."\n"
unless $self->verbose() <= 0;
$xmlprolog=$1;
}
@@ -410,11 +406,11 @@
} else {
if ($self->{options}{'force'}) {
- warn gettext("po4a::sgml: DTD of this file is unknown, but proceeding as
requested.")."\n";
+ warn "po4a::sgml: ".gettext("DTD of this file is unknown, but
proceeding as requested.")."\n";
$self->set_tags_kind();
} else {
- die sprintf(gettext(
- "po4a::sgml: DTD of this file is unknown. (supported: debiandoc,
docbook).\n".
+ die sprintf("po4a::sgml: ".gettext(
+ "DTD of this file is unknown. (supported: debiandoc, docbook).\n".
"The prolog follows:\n%s"),
$filename,$prolog)."\n";
}
@@ -573,7 +569,7 @@
my $type;
if ($event->type eq 'start_element') {
- die sprintf(gettext("po4a::Sgml: %s: Unknown tag %s"),
+ die sprintf("po4a::sgml: ".gettext("%s: Unknown tag %s"),
$refs[$parse->line],$event->data->name)."\n"
unless $exist{$event->data->name};
Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Xml.pm 7 Aug 2004 04:36:21 -0000 1.11
+++ Xml.pm 7 Aug 2004 04:51:33 -0000 1.12
@@ -189,7 +189,7 @@
foreach my $opt (keys %options) {
if ($options{$opt}) {
- die sprintf(dgettext ("po4a","po4a::xml: Unknown option: %s"),
$opt)."\n" unless exists $self->{options}{$opt};
+ die sprintf("po4a::xml: ".dgettext ("po4a","Unknown option:
%s"), $opt)."\n" unless exists $self->{options}{$opt};
$self->{options}{$opt} = $options{$opt};
}
}
@@ -266,7 +266,7 @@
} elsif ($options->{'type'} eq "attribute") {
$comment = "Attribute '".$options->{'attribute'}."'
of: ".$self->get_path;
} else {
- die dgettext("po4a","po4a::xml: Internal error: unknown type
identifier.")."\n";
+ die "po4a::xml: ".dgettext("po4a","Internal error: unknown
type identifier.")."\n";
}
$text = $self->translate($text,$ref,$comment,'wrap'=>$wrap);
@@ -321,9 +321,9 @@
=cut
-##### Generic XML tag types #####
+##### Generic XML tag types #####'
-my @tag_types = (
+my @tag_types = (
{ beginning => "!--",
end => "--",
breaking => 1,
@@ -398,7 +398,7 @@
if (defined $self->{options}{'doctype'} ) {
my $doctype = $self->{options}{'doctype'};
if ( $tag[0] !~ /\Q$doctype\E/i ) {
- die sprintf(dgettext("po4a","po4a::xml: Bad document type. '%s'
expected."),$doctype)."\n";
+ die "po4a::xml: ".sprintf(dgettext("po4a","Bad document type.
'%s' expected."),$doctype)."\n";
}
}
my $i = 0;
@@ -448,7 +448,7 @@
my $test = pop @path;
if ( $test ne $name ) {
- die dgettext("po4a","po4a::xml: Unexpected closing tag. The main
document may be wrong.")."\n";
+ die "po4a::xml: ".dgettext("po4a","Unexpected closing tag. The
main document may be wrong.")."\n";
}
return $self->join_lines(@tag);
}
@@ -770,7 +770,7 @@
$text .= $self->found_string($value, $ref, { type=>"attribute",
attribute=>$name });
} else {
$text .= $value;
- print sprintf(dgettext ("po4a","po4a::xml: Contents of attribute %s
excluded: %s"),$self->get_path.$name,$value)."\n"
+ print sprintf("po4a::xml: ".dgettext ("po4a","Contents of
attribute %s excluded: %s"),$self->get_path.$name,$value)."\n"
if $self->debug();
}
$text .= $quot;
@@ -778,7 +778,7 @@
}
}
- die sprintf(dgettext ("po4a","po4a::xml: Bad attribute syntax at
%s"),$ref)."\n";
+ die sprintf("po4a::xml: ".dgettext ("po4a","Bad attribute
syntax at %s"),$ref)."\n";
unless ($complete);
}
}
@@ -871,7 +871,7 @@
}));
} else {
# Inform that this tag isn't translated in debug mode
- print sprintf(dgettext ("po4a","po4a::xml: Contents of tag %s excluded:
%s"), $self->get_path,$self->join_lines((a)paragraph))."\n"
+ print sprintf("po4a::xml: ".dgettext ("po4a","Contents of tag
%s excluded: %s"),
$self->get_path,$self->join_lines((a)paragraph))."\n"
if $self->debug();
$self->pushline($self->join_lines(@paragraph));
}
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Po.pm 7 Aug 2004 02:15:07 -0000 1.18
+++ Po.pm 7 Aug 2004 04:51:33 -0000 1.19
@@ -142,14 +142,14 @@
sub read{
my $self=shift;
my $filename=shift
- || croak (dgettext("po4a","po4a::po: Please provide a non-nul
filename")."\n");
+ || croak ("po4a::po: ".dgettext("po4a","Please provide a
non-nul filename")."\n");
my $fh;
if ($filename eq '-') {
$fh=*STDIN;
} else {
open $fh,"<$filename"
- || croak (sprintf(dgettext("po4a","Can't read from %s:
%s"),$filename,$!)."\n");
+ || croak ("po4a::po: ".sprintf(dgettext("po4a","Can't
read from %s: %s"),$filename,$!)."\n");
}
## Read paragraphs line-by-line
Index: Man.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Man.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Man.pm 30 Jul 2004 00:17:41 -0000 1.21
+++ Man.pm 7 Aug 2004 04:51:33 -0000 1.22
@@ -375,7 +375,7 @@
$done .= $first if ($lvl > 0);
$rest=substr($rest,1);
}
- die sprintf(gettext("po4a::man: %s: Unbalanced '<' and '>' in
'%s'"),$ref||$self->{ref},$transstr)."\n"
+ die sprintf("po4a::man: %s: ".gettext("Unbalanced '<' and
'>' in '%s'"),$ref||$self->{ref},$transstr)."\n"
if ($lvl > 0);
$done .= "\\fR$rest";
$str=$done;
@@ -463,13 +463,13 @@
}
$self->{ref}="$ref";
# print STDERR "LINE=$line<<\n";
- die sprintf(gettext("po4a::man: %s: Escape sequence \\c encountered. This is not
handled yet.")
+ die sprintf("po4a::man: %s: ".gettext("Escape sequence \\c encountered.
This is not handled yet.")
,$ref)."\n"
if ($line =~ /\\c/);
if ($line =~ /^\./) {
- die sprintf(gettext("po4a::man: Unparsable line:
%s"),$line)."\n"
+ die sprintf("po4a::man: ".gettext("Unparsable line:
%s"),$line)."\n"
unless ($line =~ /^\.+\\*?(\\\")(.*)/ ||
$line =~ /^\.([BI])(\W.*)/ ||
$line =~ /^\.(\S*)(.*)/);
@@ -650,9 +650,8 @@
# Special case:
# .Dd => Indicates that this is a mdoc page
if ($macro eq 'Dd') {
- die gettext(
- "po4a::man: This page seems to be a mdoc(7) formated one.\n".
- "po4a::man: This is not supported (yet).")."\n";
+ die "po4a::man: ".gettext(
+ "This page seems to be a mdoc(7) formated one. This is not supported
(yet).")."\n";
}
unshift @args,$self;
@@ -884,9 +883,7 @@
$macro{'ad'}=\&untranslated;
# .de macro Define or redefine macro until .. is encountered.
$macro{'de'}=sub {
- die gettext(
- "po4a::man: This page defines a new macro with '.de'. Since po4a is not
a\n".
- "po4a::man: real groff parser, this is not supported.")."\n";
+ die "po4a::man: ".gettext("This page defines a new macro with
'.de'. Since po4a is not a real groff parser, this is not
supported.")."\n";
};
# .ds stringvar anything
# Set stringvar to anything.
@@ -909,9 +906,9 @@
# .ie cond anything If cond then anything else goto .el.
# .if cond anything If cond then anything; otherwise do nothing.
$macro{'ie'}=$macro{'if'}=sub {
- die sprintf(gettext(
- "po4a::man: This page uses conditionals with '%s'. Since po4a is not a
real\n".
- "po4a::man: groff parser, this is not supported.",$_[1]))."\n";
+ die sprintf("po4a::man: ".
+ gettext("This page uses conditionals with '%s'. Since po4a is not a real
groff parser, this is not supported.",
+ $_[1]))."\n";
};
# .in N Change indent according to N (default scaling indicator m).
$macro{'in'}=\&untranslated;
Index: Dia.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Dia.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Dia.pm 30 Jul 2004 00:17:41 -0000 1.3
+++ Dia.pm 7 Aug 2004 04:51:33 -0000 1.4
@@ -141,7 +141,7 @@
} else {
#Dia's default is UTF-8
$charset_dia = 'UTF-8';
- warn gettext("po4a::dia: Couldn't find file encoding. Assuming
UTF-8.")."\n";
+ warn "po4a::dia: ".dgettext("po4a","Couldn't find file
encoding. Assuming UTF-8.")."\n";
}
#how to get command line options to override it?
$charset_po = 'ISO-8859-1';