fixed some bugs
authorslubek <slubek>
Tue, 20 May 2003 22:52:03 +0000 (22:52 +0000)
committerslubek <slubek>
Tue, 20 May 2003 22:52:03 +0000 (22:52 +0000)
lang/synch

index 31cbb3cd2a0349cfe726082e854c1c27b10f1373..0bad9166efbfb79583a37629b239758b197b411c 100755 (executable)
@@ -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 <language>
@@ -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