summaryrefslogtreecommitdiff
path: root/i18n/status.sh
blob: 9205172781b5af351d44604c8fc615890bdff7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh

#
# Function:
#   showStringStats <title> <file>
#
# Parameters:
#   <title>   Title to be displayed.
#   <file>    Name of file to be counted.
#
function showStringStats ()
{
	echo -n "$1: "
	if [ -e "$2" ]; then
		csTotal=`grep translation "$2" | wc -l`
		csUnfinished=`grep translation "$2" | grep type=\"unfinished\" | wc -l`
		echo ${csUnfinished}", that means `expr ${csUnfinished} \* 100 / ${csTotal}`% needs to be done."
	else
		echo "'$2' is missing. No stats available!"
	fi
}

#
# Main
#
arg=$1
foo=$1
if [ "x${arg}x" = "xx" ]; then
	arg="."
	foo="all"
fi

#
# General figures
#
echo -e "Status of ${foo}:\n"

echo -n "Number of strings: "
strs=`find ${arg} -name "*.ts" -exec grep translation {} \; | wc -l`
echo ${strs}

echo -n "Unfinished: "
unfi=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"unfinished\" | wc -l`
echo ${unfi}", that means `expr \( ${strs} - ${unfi} \) \* 100 / ${strs}`% are done."

echo -n "Obsolete: "
obso=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"obsolete\" | wc -l`
echo ${obso}" (`expr ${obso} \* 100 / ${strs}`%)"

#
# from here on we will only look at the core-parts. All numbers have to be 0% if
# the specific language will be in the official release.
#
echo -e "\nCore:\n"

showStringStats "Addressbook" "${arg}/addressbook.ts"
showStringStats "Datebook" "${arg}/datebook.ts"
showStringStats "libopie" "${arg}/libopie.ts"
showStringStats "Today" "${arg}/today.ts"
showStringStats "Todo" "${arg}/todolist.ts"