summaryrefslogtreecommitdiff
path: root/i18n/status.sh
Unidiff
Diffstat (limited to 'i18n/status.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-xi18n/status.sh101
1 files changed, 43 insertions, 58 deletions
diff --git a/i18n/status.sh b/i18n/status.sh
index 9205172..f7fa219 100755
--- a/i18n/status.sh
+++ b/i18n/status.sh
@@ -1,60 +1,45 @@
1#!/bin/sh 1#!/bin/sh
2 2lang=`basename ${1} 2>/dev/null | tr -d '/'`
3# 3
4# Function: 4if [ "x${lang}x" = "xx" ]; then
5# showStringStats <title> <file> 5 echo "Usage: `basename ${0}` XX"
6# 6 echo " with XX as a languagecode or \"all\" for all languagecodes."
7# Parameters: 7 exit 1
8# <title> Title to be displayed. 8else
9# <file> Name of file to be counted. 9 case "${lang}" in
10# 10 "all")
11function showStringStats () 11 clear
12{ 12 printf "\ni18n Statistics for ALL languagecode\n"
13 echo -n "$1: " 13 lang="."
14 if [ -e "$2" ]; then 14 ;;
15 csTotal=`grep translation "$2" | wc -l` 15 "unmaintained"|"xx"|"en")
16 csUnfinished=`grep translation "$2" | grep type=\"unfinished\" | wc -l` 16 echo "Specified languagecode not allowed."
17 echo ${csUnfinished}", that means `expr ${csUnfinished} \* 100 / ${csTotal}`% needs to be done." 17 exit 1
18 else 18 ;;
19 echo "'$2' is missing. No stats available!" 19 *)
20 fi 20 if [ ! -d "${lang}" ]; then
21} 21 echo "Specified languagecode not avaiable."
22 22 exit 1
23# 23 fi
24# Main 24 clear
25# 25 printf "\ni18n statistics for languagecode \"${lang}\"\n\n"
26arg=$1 26 echo " .--------- Total strings"
27foo=$1 27 echo " | .----- Unfinished strings"
28if [ "x${arg}x" = "xx" ]; then 28 echo " | | .- Obsolete strings"
29 arg="." 29 echo " | | | File Name"
30 foo="all" 30 echo "--- --- --- -------------------------------------"
31 for file in `ls -1 ${1}/*.ts`; do
32 strs=`grep -c 'translation' ${file}`
33 unfi=`grep -c 'type=\"unfinished\"' ${file}`
34 obso=`grep -c 'type=\"obsolete\"' ${file}`
35 printf "%3s %3s %3s %s\n" "${strs}" "${unfi}" "${obso}" "${file}"
36 done
37 ;;
38 esac
39 strs=`find ${lang} -path './unmaintained' -prune -o -path './en' -prune -o -path './xx' -prune -o -name "*.ts" -exec grep 'translation' {} \; | wc -l`
40 unfi=`find ${lang} -path './unmaintained' -prune -o -path './en' -prune -o -path './xx' -prune -o -name "*.ts" -exec grep 'type=\"unfinished\"' {} \; | wc -l`
41 obso=`find ${lang} -path './unmaintained' -prune -o -path './en' -prune -o -path './xx' -prune -o -name "*.ts" -exec grep 'type=\"obsolete\"' {} \; | wc -l`
42 printf "\n%12s %5s\n" "Total:" ${strs}
43 printf "%12s %5s %s\n" "Unfinished:" ${unfi} "[`expr \( ${strs} - ${unfi} \) \* 100 / ${strs}`% done]"
44 printf "%12s %5s %s\n\n" "Obsolete:" ${obso} "[`expr ${obso} \* 100 / ${strs}`%]"
31fi 45fi
32
33#
34# General figures
35#
36echo -e "Status of ${foo}:\n"
37
38echo -n "Number of strings: "
39strs=`find ${arg} -name "*.ts" -exec grep translation {} \; | wc -l`
40echo ${strs}
41
42echo -n "Unfinished: "
43unfi=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"unfinished\" | wc -l`
44echo ${unfi}", that means `expr \( ${strs} - ${unfi} \) \* 100 / ${strs}`% are done."
45
46echo -n "Obsolete: "
47obso=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"obsolete\" | wc -l`
48echo ${obso}" (`expr ${obso} \* 100 / ${strs}`%)"
49
50#
51# from here on we will only look at the core-parts. All numbers have to be 0% if
52# the specific language will be in the official release.
53#
54echo -e "\nCore:\n"
55
56showStringStats "Addressbook" "${arg}/addressbook.ts"
57showStringStats "Datebook" "${arg}/datebook.ts"
58showStringStats "libopie" "${arg}/libopie.ts"
59showStringStats "Today" "${arg}/today.ts"
60showStringStats "Todo" "${arg}/todolist.ts"