[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/misc/translator VerboseWarnings.pm,1.3,1.4 tmpl_pro
From: |
Ambrose C. LI |
Subject: |
[Koha-cvs] CVS: koha/misc/translator VerboseWarnings.pm,1.3,1.4 tmpl_process3.pl,1.13,1.14 xgettext.pl,1.9,1.10 |
Date: |
Tue, 24 Feb 2004 19:37:29 -0800 |
Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9253
Modified Files:
VerboseWarnings.pm tmpl_process3.pl xgettext.pl
Log Message:
Benedict wants some message at the end that says success or failure.
It's a good idea too.
Index: VerboseWarnings.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/VerboseWarnings.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** VerboseWarnings.pm 23 Feb 2004 19:56:47 -0000 1.3
--- VerboseWarnings.pm 25 Feb 2004 03:37:27 -0000 1.4
***************
*** 26,37 ****
--- 26,44 ----
@EXPORT_OK = qw(
&pedantic_p
+ &warn_additional
&warn_normal
&warn_pedantic
+ &error_additional
&error_normal
);
+ %EXPORT_TAGS = (
+ 'warn' => [ 'warn_additional', 'warn_normal', 'warn_pedantic' ],
+ 'die' => [ 'error_additional', 'error_normal' ],
+ );
###############################################################################
use vars qw( $appName $input $input_abbr $pedantic_p $pedantic_tag );
+ use vars qw( $warned $erred );
sub set_application_name ($) {
***************
*** 40,43 ****
--- 47,54 ----
}
+ sub application_name () {
+ return $appName;
+ }
+
sub set_input_file_name ($) {
my($s) = @_;
***************
*** 71,75 ****
}
! sub warn_normal ($$) {
my($msg, $lc) = @_;
my $prefix = construct_warn_prefix('Warning', $lc);
--- 82,86 ----
}
! sub warn_additional ($$) {
my($msg, $lc) = @_;
my $prefix = construct_warn_prefix('Warning', $lc);
***************
*** 78,81 ****
--- 89,98 ----
}
+ sub warn_normal ($$) {
+ my($msg, $lc) = @_;
+ $warned += 1;
+ warn_additional($msg, $lc);
+ }
+
sub warn_pedantic ($$$) {
my($msg, $lc, $flag) = @_;
***************
*** 88,94 ****
$$flag = 1;
}
}
! sub error_normal ($$) {
my($msg, $lc) = @_;
my $prefix = construct_warn_prefix('ERROR', $lc);
--- 105,112 ----
$$flag = 1;
}
+ $warned += 1;
}
! sub error_additional ($$) {
my($msg, $lc) = @_;
my $prefix = construct_warn_prefix('ERROR', $lc);
***************
*** 97,99 ****
--- 115,127 ----
}
+ sub error_normal ($$) {
+ my($msg, $lc) = @_;
+ $erred += 1;
+ error_additional($msg, $lc);
+ }
+
+ sub warned () {
+ return $warned; # number of times warned
+ }
+
###############################################################################
Index: tmpl_process3.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process3.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** tmpl_process3.pl 24 Feb 2004 14:20:46 -0000 1.13
--- tmpl_process3.pl 25 Feb 2004 03:37:27 -0000 1.14
***************
*** 17,21 ****
use File::Temp qw( :POSIX );
use TmplTokenizer;
! use VerboseWarnings qw( error_normal warn_normal );
###############################################################################
--- 17,21 ----
use File::Temp qw( :POSIX );
use TmplTokenizer;
! use VerboseWarnings qw( :warn :die );
###############################################################################
***************
*** 150,153 ****
--- 150,154 ----
The -o option is ignored for the "create" and "update" actions.
+ Try `perldoc $0' for perhaps more information.
EOF
exit($exitcode);
***************
*** 155,158 ****
--- 156,160 ----
###############################################################################
+
sub usage_error (;$) {
for my $msg (split(/\n/, $_[0])) {
***************
*** 241,244 ****
--- 243,247 ----
my $xgettext = './xgettext.pl'; # actual text extractor script
+ my $st;
if ($action eq 'create') {
***************
*** 256,262 ****
close $tmph;
# Generate the specified po file ($str_file)
! my $st = system ($xgettext, '-s', '-f', $tmpfile, '-o', $str_file);
warn_normal "Text extraction failed: $xgettext: $!\n", undef if $st != 0;
! unlink $tmpfile || warn_normal "$tmpfile: unlink failed: $!\n", undef;
} elsif ($action eq 'update') {
--- 259,265 ----
close $tmph;
# Generate the specified po file ($str_file)
! $st = system ($xgettext, '-s', '-f', $tmpfile, '-o', $str_file);
warn_normal "Text extraction failed: $xgettext: $!\n", undef if $st != 0;
! # unlink $tmpfile || warn_normal "$tmpfile: unlink failed: $!\n", undef;
} elsif ($action eq 'update') {
***************
*** 270,274 ****
close $tmph1;
# Generate the temporary file that acts as <MODULE>/<LANG>.pot
! my $st = system($xgettext, '-s', '-f', $tmpfile1, '-o', $tmpfile2,
'--po-mode',
(defined $charset_in? ('-I', $charset_in): ()),
--- 273,277 ----
close $tmph1;
# Generate the temporary file that acts as <MODULE>/<LANG>.pot
! $st = system($xgettext, '-s', '-f', $tmpfile1, '-o', $tmpfile2,
'--po-mode',
(defined $charset_in? ('-I', $charset_in): ()),
***************
*** 278,288 ****
# FIXME: msgmerge(1) is a Unix dependency
# FIXME: need to check the return value
! system('msgmerge', '-U', '-s', $str_file, $tmpfile2);
} else {
! warn_normal "Text extraction failed: $xgettext: $!\n", undef;
! warn_normal "Will not run msgmerge\n", undef;
}
! unlink $tmpfile1 || warn_normal "$tmpfile1: unlink failed: $!\n", undef;
! unlink $tmpfile2 || warn_normal "$tmpfile2: unlink failed: $!\n", undef;
} elsif ($action eq 'install') {
--- 281,291 ----
# FIXME: msgmerge(1) is a Unix dependency
# FIXME: need to check the return value
! $st = system('msgmerge', '-U', '-s', $str_file, $tmpfile2);
} else {
! error_normal "Text extraction failed: $xgettext: $!\n", undef;
! error_additional "Will not run msgmerge\n", undef;
}
! # unlink $tmpfile1 || warn_normal "$tmpfile1: unlink failed: $!\n", undef;
! # unlink $tmpfile2 || warn_normal "$tmpfile2: unlink failed: $!\n", undef;
} elsif ($action eq 'install') {
***************
*** 329,332 ****
--- 332,342 ----
usage_error('Unknown action specified.');
}
+
+ if ($st == 0) {
+ printf "The %s seems to be successful, with %d warning(s).\n",
+ $action, VerboseWarnings::warned;
+ } else {
+ printf "%s FAILED.\n", "\u$action";
+ }
exit 0;
Index: xgettext.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/xgettext.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** xgettext.pl 24 Feb 2004 14:20:46 -0000 1.9
--- xgettext.pl 25 Feb 2004 03:37:27 -0000 1.10
***************
*** 237,240 ****
--- 237,242 ----
Informative output:
--help Display this help and exit
+
+ Try `perldoc $0' for perhaps more information.
EOF
exit($exitcode);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/misc/translator VerboseWarnings.pm,1.3,1.4 tmpl_process3.pl,1.13,1.14 xgettext.pl,1.9,1.10,
Ambrose C. LI <=