-rwxr-xr-x | i18n/status.sh | 101 |
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 | 2 | lang=`basename ${1} 2>/dev/null | tr -d '/'` | |
3 | # | 3 | |
4 | # Function: | 4 | if [ "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. | 8 | else |
9 | # <file> Name of file to be counted. | 9 | case "${lang}" in |
10 | # | 10 | "all") |
11 | function 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" |
26 | arg=$1 | 26 | echo " .--------- Total strings" |
27 | foo=$1 | 27 | echo " | .----- Unfinished strings" |
28 | if [ "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}`%]" | ||
31 | fi | 45 | fi |
32 | |||
33 | # | ||
34 | # General figures | ||
35 | # | ||
36 | echo -e "Status of ${foo}:\n" | ||
37 | |||
38 | echo -n "Number of strings: " | ||
39 | strs=`find ${arg} -name "*.ts" -exec grep translation {} \; | wc -l` | ||
40 | echo ${strs} | ||
41 | |||
42 | echo -n "Unfinished: " | ||
43 | unfi=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"unfinished\" | wc -l` | ||
44 | echo ${unfi}", that means `expr \( ${strs} - ${unfi} \) \* 100 / ${strs}`% are done." | ||
45 | |||
46 | echo -n "Obsolete: " | ||
47 | obso=`find ${arg} -name "*.ts" -exec grep translation {} \; | grep type=\"obsolete\" | wc -l` | ||
48 | echo ${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 | # | ||
54 | echo -e "\nCore:\n" | ||
55 | |||
56 | showStringStats "Addressbook" "${arg}/addressbook.ts" | ||
57 | showStringStats "Datebook" "${arg}/datebook.ts" | ||
58 | showStringStats "libopie" "${arg}/libopie.ts" | ||
59 | showStringStats "Today" "${arg}/today.ts" | ||
60 | showStringStats "Todo" "${arg}/todolist.ts" | ||