[Po4a-commits] "po4a/lib/Locale/Po4a TeX.pm,1.78,1.79"
Denis Barbier
barbier at alioth.debian.org
Tue Oct 4 12:09:51 UTC 2005
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv21075/lib/Locale/Po4a
Modified Files:
TeX.pm
Log Message:
Make error messages translatable in the TeX module [Nicolas Francois]
Index: TeX.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TeX.pm,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- TeX.pm 24 Sep 2005 22:28:34 -0000 1.78
+++ TeX.pm 4 Oct 2005 12:09:48 -0000 1.79
@@ -485,8 +485,11 @@
# verify the number of arguments
my($check,$reason,$remainder) = check_arg_count($self,$command,\@args);
if (not $check) {
- die "Error while checking the number of arguments of the ".
- "'$command' command at ".$self->{ref}.". $reason\n";
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Error while checking the number of ".
+ "arguments of the '%s' command: %s")."\n",
+ $command, $reason);
}
if (@$remainder) {
@@ -566,8 +569,11 @@
$variant = $3;
my($check,$reason,$remainder) = check_arg_count($self,$command,\@args);
if (not $check) {
- die "Error while checking the number of arguments of the ".
- "'$command' command at ".$self->{ref}.". $reason\n";
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Error while checking the number of ".
+ "arguments of the '%s' command: %s")."\n",
+ $command, $reason);
}
if (@$remainder) {
# FIXME: we should also keep the spaces to be idempotent
@@ -1223,7 +1229,7 @@
($t, @e) = &{$environments{$envir}}($self,$command,$variant,
$args,$env);
} else {
- die wrap_mod("po4a::tex",
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
dgettext("po4a", "unknown environment: '%s'"),
$args->[1]);
}
@@ -1290,8 +1296,11 @@
if ($count >= scalar @arg_types) {
# The number of arguments does not match,
# and a variable number of arguments was not specified
-#FIXME: die message, this should have been found before => mail
- die "wrong number of argument '$command'@$args'$count'$type'\n";
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Wrong number of arguments for ".
+ "the '%s' command.")."\n",
+ $command);
} elsif ($type eq $arg_types[$count]) {
$have_to_be_translated = $arg_translated[$count];
$count ++;
@@ -1301,8 +1310,12 @@
$count++;
goto TEST_TYPE;
} else {
-#FIXME: msg
- die "optional argument provided, but a mandatory one is expected\n"
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Command '%s': An optional argument ".
+ "was provided, but a mandatory one ".
+ "is expected.")."\n",
+ $command);
}
if ($have_to_be_translated) {
($t, @e) = translate_buffer($self,$opt,(@$env,$command.$type."#".$count.$type_end{$type}));
@@ -1353,7 +1366,11 @@
$command_parameters{$command}{'nb_args'} = "";
$commands{$command} = \&generic_command;
} else {
- die "register_generic_command: unsupported format: '$_[0]'.\n"
+ die wrap_mod("po4a::tex",
+ dgettext("po4a",
+ "register_generic_command: unsupported ".
+ "format: '%s'.")."\n",
+ $_[0]);
}
}
@@ -1390,9 +1407,11 @@
my $have_to_be_translated = 0;
TEST_TYPE:
if ($count >= scalar @arg_types) {
-# FIXME: die msg
- warn "wrong number of argument. This should have been found ".
- "earlier.\n'$command'$new_env'@$args'$count'$type'\n";
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Wrong number of arguments for ".
+ "the '%s' command.")."\n",
+ $command);
} elsif ($type eq $arg_types[$count]) {
$have_to_be_translated = $arg_translated[$count];
$count ++;
@@ -1402,7 +1421,12 @@
$count++;
goto TEST_TYPE;
} else {
- die "optional argument provided, but a mandatory one is expected\n"
+ die wrap_ref_mod($self->{ref}, "po4a::tex",
+ dgettext("po4a",
+ "Command '%s': An optional argument ".
+ "was provided, but a mandatory one ".
+ "is expected.")."\n",
+ $command);
}
if ($have_to_be_translated) {
@@ -1451,8 +1475,8 @@
# The name of the environment is mandatory
if ( (not defined $type)
or ($type ne '{')) {
-# FIXME: gettext
- $reason = "The first argument of \\begin is mandatory.";
+ $reason = dgettext("po4a",
+ "The first argument of \\begin is mandatory.");
$check = 0;
}
my $env = shift @targs;
@@ -1484,8 +1508,9 @@
goto TEST_TYPE;
} else {
$check = 0;
-# FIXME: gettext
- $reason = "An optional argument was provided, but a mandatory one is expected.";
+ $reason = dgettext("po4a",
+ "Command '%s': An optional argument was ".
+ "provided, but a mandatory one is expected.");
}
}
More information about the Po4a-commits
mailing list