# 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>
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
}
# 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