--- loncom/localize/localize/synch.pl 2003/11/28 02:12:05 1.7 +++ loncom/localize/localize/synch.pl 2008/07/10 19:10:26 1.8 @@ -52,6 +52,7 @@ foreach my $fn (<*.pm>) { open(IN,$fn.'.original'); open(OUT,'>'.$fn); my $found=0; + # Rebuild current translation file until SYNCMARKER: while () { if ($_=~/\#\s*SYNCMARKER/) { $found=1; last; } print OUT $_; @@ -59,13 +60,15 @@ foreach my $fn (<*.pm>) { if ($found) { $i=0; print OUT "\n\#SYNC ".localtime()."\n"; + # Sync master with current translation file: foreach my $key (sort keys %master) { unless ($key) { next; } unless ($lang{$key}) { my $comment=''; my $copytrans=$key; + # Create comment based on already existing translations: foreach (reverse sort keys %lang) { - $copytrans=~s/$_/$lang{$_}/gsi; + $copytrans=~s/\Q$_\E/$lang{$_}/gsi; # \Q \E: escape meta characters } if (lc($copytrans) ne lc($key)) { $comment='# '.$copytrans;