From cdc55022ca52ddaf787b655d061721464eac8946 Mon Sep 17 00:00:00 2001 From: slubek Date: Tue, 20 May 2003 22:52:03 +0000 Subject: [PATCH] fixed some bugs --- lang/synch | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lang/synch b/lang/synch index 31cbb3cd..0bad9166 100755 --- a/lang/synch +++ b/lang/synch @@ -2,7 +2,8 @@ # This script will synchronize language file with the master # english translation using chriskl's langcheck utility. # It doesn't translate strings, only inserts english versions -# to proper positions and deletes removed. Use it at your own risk! +# to proper positions and deletes removed. And it doesn't +# synchronize commented lines. Use it at your own risk! # You need to have GNU ed installed. # # Usage: synch @@ -39,16 +40,16 @@ function grep_n(what, where, n, ln) { BEGIN { line=1 } # Analyse of "php langcheck language" output. # Chris - please, do not change those texts in langcheck :-) -/^Missing/ { oper="+" } -/^Deleted/ { oper="-" } -/^Source/ { src=$3 } -/^Target/ { trg=$3 } +/^Missing/ { oper="+" } +/^Deleted/ { oper="-" } +/^Source/ { src=$3 } +/^Target/ { trg=$3 } /\$lang/ { split($1, a, "\\x27"); # a[2] = strxxxxx # Adding a line if(oper=="+") { - line = grep_n(a[2],src) - 1; + line = grep_n("\x27"a[2]"\x27", src) - 1; if (line>0) { print line"a"; # New lines got no "\t" at beginning because they are not @@ -59,20 +60,15 @@ BEGIN { line=1 } } # Deleting a line if(oper=="-") { - line = grep_n(a[2],trg); + line = grep_n("\x27"a[2]"\x27", trg); if (line>0) { print line"d" } } - - # Writing changes after every edit - print "w"; } -' > $1.ed - -cat $1.ed | ed $1.php - -# For testing -exit +END { + # Writing changes after every edit + print "w"; + } +' | ed $1.php -rm $1.ed -- 2.39.5