diff options
author | koem <koem@petoria.de> | 2011-09-28 06:20:12 +0200 |
---|---|---|
committer | koem <koem@petoria.de> | 2011-09-28 06:20:12 +0200 |
commit | 199f0935bdf9cc121709bdf644ec296439eebcb6 (patch) | |
tree | 10fc11f22954e3b0d0d7bbef38715af1e4c90dca /main | |
parent | 7ab4677f19a38590f6de1d3d6a3ed452aeeffd3f (diff) | |
download | cgeo-199f0935bdf9cc121709bdf644ec296439eebcb6.zip cgeo-199f0935bdf9cc121709bdf644ec296439eebcb6.tar.gz cgeo-199f0935bdf9cc121709bdf644ec296439eebcb6.tar.bz2 |
findmissingtranslations: give language as command line parameter
Diffstat (limited to 'main')
-rwxr-xr-x | main/project/localization/findmissingtranslations.sh | 36 |
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 |