aboutsummaryrefslogtreecommitdiffstats
path: root/main/project/localization/findmissingtranslations.sh
diff options
context:
space:
mode:
Diffstat (limited to 'main/project/localization/findmissingtranslations.sh')
-rwxr-xr-xmain/project/localization/findmissingtranslations.sh36
1 files changed, 30 insertions, 6 deletions
diff --git a/main/project/localization/findmissingtranslations.sh b/main/project/localization/findmissingtranslations.sh
index e8fb1a8..cf63590 100755
--- a/main/project/localization/findmissingtranslations.sh
+++ b/main/project/localization/findmissingtranslations.sh
@@ -5,7 +5,7 @@ getnames () {
}
finddiffs () {
- echo "Missing translations for language '$1':" > $1.missing
+ echo "translations missing or not in the right place for language '$1':" > $1.missing
diff -y en.str $1.str > tmp.str
echo "Only in values/strings.xml:" >> $1.missing
grep "<\||" tmp.str | cut -d " " -f 1 | while read s; do
@@ -16,20 +16,44 @@ finddiffs () {
grep "<string" ../../res/values-$1/strings.xml | grep "name=\"$s\""
done >> $1.missing
rm tmp.str
- # 3 comments
- [ `cat $1.missing | wc -l` -lt 4 ] && rm $1.missing
+}
+
+usage() {
+ echo "Usage: $0 [ <lang-code> | all ]"
+ echo " where <lang-code> is one of:"
+ echo "$alllangs"
+ exit 1
}
cd `dirname "$0"`
+alllangs=`find ../../res/values-* -name "strings.xml" | sed "s/^.*values-\(..\).*$/ \1/"`
+
+if [ $# -ne 1 ]; then
+ usage
+elif [ "$1" != "all" -a ! -f ../../res/values-$1/strings.xml ]; then
+ echo "language file res/values-$1/strings.xml not present"
+ echo
+ usage
+fi
+
+if [ "$1" == "all" ]; then
+ langs=$alllangs
+else
+ langs=$1
+fi
+
echo processing en...
getnames ../../res/values/strings.xml > en.str
-for l in `find ../../res/values-* -name "strings.xml" | sed "s/^.*values-\(..\).*$/\1/"`; do
+for l in $langs; do
echo processing $l...
getnames ../../res/values-$l/strings.xml > $l.str
finddiffs $l
done
rm *.str
echo "missing translations:"
-# Do not count 3 comments
-wc -l *.missing | sed "s/\.missing//" | awk '{print $1-3" "$2}'
+
+for l in $langs; do
+ # Do not count 3 comments
+ wc -l $l.missing | sed "s/\.missing//" | awk '{print $2": "$1-3}'
+done