summaryrefslogtreecommitdiff
path: root/i18n/status.sh
authormellen <mellen>2003-01-16 00:22:26 (UTC)
committer mellen <mellen>2003-01-16 00:22:26 (UTC)
commit4e6e6deda15467fe253b546136df00cf5b7ebd02 (patch) (side-by-side diff)
treebbc514403ab07c03b6a17c2678297643898fba4a /i18n/status.sh
parentc9286a607b460274a070e10f34863920dae0b9a9 (diff)
downloadopie-4e6e6deda15467fe253b546136df00cf5b7ebd02.zip
opie-4e6e6deda15467fe253b546136df00cf5b7ebd02.tar.gz
opie-4e6e6deda15467fe253b546136df00cf5b7ebd02.tar.bz2
Cleaned up, optimized and polished.
Diffstat (limited to 'i18n/status.sh') (more/less context) (ignore whitespace changes)
-rwxr-xr-xi18n/status.sh96
1 files changed, 55 insertions, 41 deletions
diff --git a/i18n/status.sh b/i18n/status.sh
index 859c442..9205172 100755
--- a/i18n/status.sh
+++ b/i18n/status.sh
@@ -1,46 +1,60 @@
-#/bin/sh
+#!/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=.
+if [ "x${arg}x" = "xx" ]; then
+ arg="."
foo="all"
fi
-#general figures
-echo "Status of $foo"
-echo
-
-echo "number of strings: "
-strs=`find $arg -name "*.ts" -exec cat {} \; | grep translation | wc -l`
-echo $strs
-echo "unfinished: "
-unfi=`find $arg -name "*.ts" -exec cat {} \; | grep translation | grep type=\"unfinished\" | wc -l`
-echo $unfi", that means" `expr \( $strs - $unfi \) \* 100 / $strs`% "are done"
-echo "obsolete: "
-obso=`find $arg -name "*.ts" -exec cat {} \; | grep translation | grep type=\"obsolete\" | wc -l`
-echo $obso `expr $obso \* 100 / $strs`%
-
-#if [ "foo" = "all" ]
-#then
- #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
- echo "Core:"
- core_today=`grep translation $arg/today.ts | grep type=\"unfinished\" | wc -l`
- core_todo=`grep translation $arg/todolist.ts | grep type=\"unfinished\" | wc -l`
- core_addressbook=`grep translation $arg/addressbook.ts | grep type=\"unfinished\" | wc -l`
- core_datebook=`grep translation $arg/datebook.ts | grep type=\"unfinished\" | wc -l`
- libopie=`grep translation $arg/libopie.ts | grep type=\"unfinished\" | wc -l`
- _core_today=`grep translation $arg/today.ts | wc -l`
- _core_todo=`grep translation $arg/todolist.ts | wc -l`
- _core_addressbook=`grep translation $arg/addressbook.ts | wc -l`
- _core_datebook=`grep translation $arg/datebook.ts | wc -l`
- _libopie=`grep translation $arg/libopie.ts | wc -l`
-#fi
-
- echo "Today:" $core_today", that means" `expr $core_today \* 100 / $_core_today`% "needs to be done"
- echo "Datebook:" $core_datebook", that means" `expr $core_datebook \* 100 / $_core_datebook`% "needs to be done"
- echo "Todo:" $core_todo", that means" `expr $core_todo \* 100 / $_core_todo`% "needs to be done"
- echo "Addressbook:" $core_addressbook", that means" `expr $core_addressbook \* 100 / $_core_addressbook`% "needs to be done"
- echo "libopie:" $libopie", that means" `expr $libopie \* 100 / $_libopie`% "needs to be done"
+#
+# 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"