Annotation of loncom/localize/localize/synch.pl, revision 1.3
1.3 ! www 1:
! 2:
1.1 www 3: sub readlexicon {
4: my $fn=shift;
5: open(IN,$fn);
6: my %lexicon=();
7: my $contents=join('',<IN>);
8: close(IN);
9: $contents=~s/package Apache\:[^\;]+//;
10: $contents=~s/use base[^\;]+//;
11: eval($contents.'; %lexicon=%Lexicon;');
12: delete $lexicon{'_AUTO'};
13: delete $lexicon{'char_encoding'};
14: delete $lexicon{'language_code'};
15: return %lexicon;
16: }
17:
1.2 www 18: my %master=();
19: foreach (<*.pm>) {
20: print "Reading: ".$_."\n";
21: %master=(%master,&readlexicon($_));
22: }
1.3 ! www 23: foreach $fn (<*.pm>) {
! 24: print "Synching: ".$fn."\n";
1.2 www 25: my %lang=&readlexicon($_);
1.3 ! www 26: system ("cp $fn $fn.original");
1.2 www 27: open(IN,$fn.'.original');
28: open(OUT,'>'.$fn);
29: my $found=0;
30: foreach (<IN>) {
31: if ($_=~/\#\s*SYNCMARKER/) { $found=1; last; }
32: print OUT $_;
33: }
34: if ($found) {
35: print OUT "\n\#SYNC ".localtime."\n";
36:
37: print OUT "\n\#SYNCMARKER\n";
38: foreach (<IN>) {
39: print OUT $_;
40: }
41: }
42: close (IN);
43: close (OUT);
44: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>