mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-17 09:34:08 +01:00
look for plurals too
This commit is contained in:
parent
805f160556
commit
c0e8f9cb65
2 changed files with 54 additions and 17 deletions
xwords4/android/scripts
|
@ -7,24 +7,32 @@ set -e -u
|
||||||
|
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
|
|
||||||
IDS=$(./string-names.sh ../XWords4/res/values/strings.xml)
|
checkStrings() {
|
||||||
STR_COUNT=$(echo $IDS | wc -w)
|
TYP=$1
|
||||||
|
IDS="$2"
|
||||||
|
STR_COUNT=$(echo $IDS | wc -w)
|
||||||
|
|
||||||
JAVA_FILES=$(find ../ -name '*.java')
|
JAVA_FILES=$(find ../ -name '*.java')
|
||||||
XML_FILES="$(find ../XWords4/res/ -name '*.xml') ../XWords4/AndroidManifest.xml"
|
XML_FILES="$(find ../XWords4/res/ -name '*.xml') ../XWords4/AndroidManifest.xml"
|
||||||
FILE_COUNT=$(( $(echo $JAVA_FILES | wc -w) + $(echo $XML_FILES | wc -w) ))
|
FILE_COUNT=$(( $(echo $JAVA_FILES | wc -w) + $(echo $XML_FILES | wc -w) ))
|
||||||
|
|
||||||
echo "checking $STR_COUNT string ids in $FILE_COUNT files..."
|
echo "checking $STR_COUNT $TYP ids in $FILE_COUNT files..."
|
||||||
|
|
||||||
for ID in $IDS; do
|
for ID in $IDS; do
|
||||||
RID="R.string.${ID}"
|
RID="R.${TYP}.${ID}"
|
||||||
if grep -qr $RID $JAVA_FILES; then
|
if grep -qr $RID $JAVA_FILES; then
|
||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RID="@string/${ID}"
|
RID="@string/${ID}"
|
||||||
if grep -qr $RID $XML_FILES; then
|
if grep -qr $RID $XML_FILES; then
|
||||||
continue;
|
continue;
|
||||||
fi
|
fi
|
||||||
echo "$ID not found"
|
echo "$ID not found"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
STR_IDS=$(./string-names.sh ../XWords4/res/values/strings.xml)
|
||||||
|
checkStrings string "$STR_IDS"
|
||||||
|
PLRL_IDS=$(./plurals-names.sh ../XWords4/res/values/strings.xml)
|
||||||
|
checkStrings plurals "$PLRL_IDS"
|
||||||
|
|
29
xwords4/android/scripts/plurals-names.sh
Executable file
29
xwords4/android/scripts/plurals-names.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -u -e
|
||||||
|
|
||||||
|
FILE=""
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
[ $# -ge 1 ] && echo "ERROR: $1"
|
||||||
|
echo "usage: $0 <path/to/file.xml>"
|
||||||
|
echo "print all string names in the .xml file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $# -ge 1 ]; do
|
||||||
|
case $1 in
|
||||||
|
--help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FILE=$1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -n "$FILE" ] || usage "file parameter missing"
|
||||||
|
[ -e $FILE ] || usage "File $FILE not found"
|
||||||
|
|
||||||
|
xmlstarlet sel -T -t -m "/resources/plurals" -v @name -n $FILE
|
Loading…
Add table
Reference in a new issue