misc/loc_gen.txt
author mk12
Fri, 07 Dec 2012 16:03:53 -0500
branchflibqtfrontend
changeset 8267 9cf64a5c3445
parent 7935 f8941f0b7bef
child 12013 3e615852f36e
permissions -rw-r--r--
will fix this http://code.google.com/p/hedgewars/source/detail?r=9f0e79ab51f00f3b1e133ae70cdd63f6963439c0 and will allow hedgewars to build without video recording enabled, for the time being although i want to talk to koda or someone to understand what should be #ifdef'd and if i've done too much or too little.. but at least that will let it build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7828
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     1
# this is inefficient and clunky, but, figured it might as well be kept somewhere so people are aware of it
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     2
# Is how I'm currently updated the locale files.
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     3
# collect strings - run in Data
7935
f8941f0b7bef update lua (remove duplicate strings, esp in fr.lua - mostly my fault - and add a bit more escaping to the crude script)
nemo
parents: 7828
diff changeset
     4
grep -F 'loc("' */*/*.lua | sed 's/")/")\n/g' | sed 's/.*loc("/loc("/;s/").*/")/' | grep loc | sort | uniq  > loc.txt
7828
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     5
# Update locale files - run in Locale
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     6
for i in *.lua;do cat ../loc.txt | while read f;do STR=$(echo "$f" | sed 's/loc("//;s/")\s*$//;s/"/\\"/g');MAPS=$(grep -F -l -- "loc(\"${STR}\")" ../*/*/*.lua ../*/*/*/*.lua | sed 's/.*\/\([^\/]*\)\/map.lua/\1/;s/.*Campaign\/\([^\/]*\)\//\1:/;s/.*\///;s/.lua//;s/ /_/g' | xargs | sed 's/ /, /g');C=$(echo $MAPS | sed 's/,/\n/' | wc -l);grep -Fq -- "[\"${STR}\"]" $i;if(($?));then if((C>0));then echo "--      [\"${STR}\"] = \"\", -- $MAPS" >> $i;else echo "--      [\"${STR}\"] = \"\"," >> $i;fi;fi;done;done
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     7
# sort - run in Locale
7935
f8941f0b7bef update lua (remove duplicate strings, esp in fr.lua - mostly my fault - and add a bit more escaping to the crude script)
nemo
parents: 7828
diff changeset
     8
for i in *.lua;do rm temphead temptail templua;cat $i | grep -Ev "}|{" | grep -Ev "^[[:space:]]*$" | sort | uniq > templua;echo "locale = {" > temphead;echo "    }" > temptail;cat temphead templua temptail > $i;done
7828
63d9ea2c63be eh. might as well toss this in for reference purposes
nemo
parents:
diff changeset
     9
# drop unused - run in Locale
7935
f8941f0b7bef update lua (remove duplicate strings, esp in fr.lua - mostly my fault - and add a bit more escaping to the crude script)
nemo
parents: 7828
diff changeset
    10
cat stub.lua | grep '"] =' | while read f;do PHRASE=$(echo "$f" | sed 's/[^[]*\["//;s/"] =.*//;s/"/\\"/g');CNT=$(grep -Frc "loc(\"$PHRASE\")" ../*/*/*.lua ../*/*/*/*.lua | grep -v ":0" | wc -l);if(($CNT==0));then echo "|$PHRASE|";PHRASE=$(echo "$PHRASE" | sed 's/\\/\\\\/g;s/\[/\\[/g;s/\]/\\]/g;s/\//\\\//g');sed -i "s/.*\[\"$PHRASE\"\].*//" *.lua;fi;done