Update of /cvsroot/jprojecttimer/jprojecttimer
In directory usw-pr-cvs1:/tmp/cvs-serv11122
Modified Files:
checkTranslation.pl
Log Message:
Code cleanups, see patch #505289
Index: checkTranslation.pl
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/checkTranslation.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** checkTranslation.pl 2002/01/17 22:43:30 1.3
--- checkTranslation.pl 2002/01/18 21:31:30 1.4
***************
*** 4,8 ****
# checks the translated properties for missing or double tags etc.
#
! # 2001,2002 (c) by Christian Garbs <mi...@cg...>
#
# part of JProjectTimer - http://jprojecttimer.cgarbs.de
--- 4,8 ----
# checks the translated properties for missing or double tags etc.
#
! # 2001 (c) by Christian Garbs <mi...@un...>
#
# part of JProjectTimer - http://jprojecttimer.cgarbs.de
***************
*** 14,45 ****
use File::Find;
! sub wanted;
# Default values that must be present even if not used in source code
! my %keywords = map { $_, 1 } (
! 'CVS_TAG'
! );
print "reading all source files...\n";
- my @filelist;
- find( sub { push @filelist, "$File::Find::dir/$_" if substr($_, -5) eq ".java" } , '.');
-
- foreach my $source (@filelist) {
- open IN, "<$source" or die "can't open $source: $!";
- my @lines = grep /Resource.get/, <IN>;
- foreach my $line (@lines) {
- while ($line =~ /Resource.get\(\"([^\"]*)\"\)/) {
- $line =~ s/Resource.get\(\"([^\"]*)\"\)//;
- $keywords{$1}++;
- }
- }
- close IN or die "can't close $source: $!";
- }
-
- my $err = 0;
print "reading all resources...\n";
!
foreach my $source (glob "JProjectTimerResource*.properties") {
print "checking $source...\n";
--- 14,28 ----
use File::Find;
! sub scanfile;
# Default values that must be present even if not used in source code
! my %keywords = ( 'CVS_TAG' => 1 );
print "reading all source files...\n";
+ find( \&scanfile, '.');
print "reading all resources...\n";
! my $err = 0;
foreach my $source (glob "JProjectTimerResource*.properties") {
print "checking $source...\n";
***************
*** 52,56 ****
}
close IN or die "can't close $source: $!";
!
print " multiple keys:\n";
foreach my $key (grep $file{$_} > 1, keys %file) {
--- 35,39 ----
}
close IN or die "can't close $source: $!";
!
print " multiple keys:\n";
foreach my $key (grep $file{$_} > 1, keys %file) {
***************
*** 78,80 ****
--- 61,79 ----
} else {
print "everthing's ok\n\n";
+ }
+
+ exit $err;
+
+ sub scanfile {
+ return unless substr($_, -5) eq ".java";
+ my $source = "$File::Find::dir/$_";
+ open IN, "<$_" or die "can't open $source: $!";
+ my @lines = grep /Resource.get/, <IN>;
+ foreach my $line (@lines) {
+ while ($line =~ /Resource.get\(\"([^\"]*)\"\)/) {
+ $line =~ s/Resource.get\(\"([^\"]*)\"\)//;
+ $keywords{$1}++;
+ }
+ }
+ close IN or die "can't close $source: $!";
}
|