script to check .xml and .java files for missing string entries and to

add stubs.
This commit is contained in:
ehouse 2010-01-26 04:02:05 +00:00
parent 8a4c31b203
commit 73749f97a5

View file

@ -0,0 +1,32 @@
#!/bin/sh
check_add () {
STRING=$1
PAT="<string name=\"$STRING\">.*</string>"
if ! grep -q "$PAT" res/values/strings.xml; then
echo "<string name=\"$STRING\">$STRING</string>"
fi
}
BASE=$(dirname $0)
cd $BASE/../XWords4
for XML_FILE in $(find res/layout -name '*.xml'); do
for STRING in $(grep 'android:text=' $XML_FILE | sed 's,^.*"@string/\(.*\)".*$,\1,'); do
check_add $STRING
done
done
for XML_FILE in $(find res/menu -name '*.xml'); do
for STRING in $(grep 'android:title=' $XML_FILE | sed 's,^.*"@string/\(.*\)".*$,\1,'); do
check_add $STRING
done
done
for JAVA_FILE in $(find src -name '*.java'); do
for STRING in $(grep -E 'R\.string\.' $JAVA_FILE | sed 's/^.*R\.string\.\([a-z_]*\).*$/\1/'); do
check_add $STRING
done
done