--- loncom/localize/localize/synch.pl 2009/06/03 16:33:15 1.13 +++ loncom/localize/localize/synch.pl 2009/12/09 10:30:45 1.14 @@ -26,7 +26,8 @@ my $debug=0; # If you want to exclude translation files from being included # in the synching process, remove their file names from this list. my @listoffiles=( - 'ar.pm' +# 'test.pm' + ,'ar.pm' ,'de.pm' ,'es.pm' ,'fa.pm' @@ -77,8 +78,9 @@ sub readnew { open(IN,'newphrases.txt') or die; my %lexicon=(); while (my $line=) { - chomp($line); - $lexicon{$line}=$line; + chomp($line); + next if ($line eq ''); + $lexicon{$line}=$line; print " New entry: '$line'\n" if $debug; } close(IN); @@ -97,9 +99,9 @@ sub takethisfile { # ---------------------------------------------------------------- # ----- Main Program ----- -my $i; +my $i; # Count new phrases my $num; -my $dlm; +my $dlm; # Delimiter character my $comment; print "*** Synching Translation Files ***\n"; @@ -131,6 +133,7 @@ open(IN,'removephrases.txt') or die; my $rm=0; while (my $line=) { chomp($line); + next if ($line eq ''); delete $master{$line}; $rm++; } @@ -165,7 +168,7 @@ foreach my $fn (<*.pm>) { # Sync master with current translation file: foreach my $key (sort keys %master) { print "\n Checking key: '$key'" if $debug; - unless ($key) { next; } + next unless ($key); unless ($lang{$key}) { # Translation helper? if ($helper) { @@ -187,10 +190,10 @@ foreach my $fn (<*.pm>) { $num=''; } # Find delimiter for key and value - if (($key=~/\'/) & ($key=~/\"/)) { - $quotwarn++; - print " Warning: Both, ' and \",occur!" if $debug; - } + if (($key=~/\'/) & ($key=~/\"/)) { + $quotwarn++; + print " (Warning: Both, ' and \", occur!)" if $debug; + } # if (($key=~/[^\\]\'/) | ($key=~/\\\"/)) { if ($key=~/\'/) { $dlm='"';