-rwxr-xr-x | i18n/status.sh | 95 |
1 files changed, 40 insertions, 55 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 | lang=`basename ${1} 2>/dev/null | tr -d '/'` | ||
2 | 3 | ||
3 | # | 4 | if [ "x${lang}x" = "xx" ]; then |
4 | # Function: | 5 | echo "Usage: `basename ${0}` XX" |
5 | # showStringStats <title> <file> | 6 | echo " with XX as a languagecode or \"all\" for all languagecodes." |
6 | # | 7 | exit 1 |
7 | # Parameters: | ||
8 | # <title> Title to be displayed. | ||
9 | # <file> Name of file to be counted. | ||
10 | # | ||
11 | function showStringStats () | ||
12 | { | ||
13 | echo -n "$1: " | ||
14 | if [ -e "$2" ]; then | ||
15 | csTotal=`grep translation "$2" | wc -l` | ||
16 | csUnfinished=`grep translation "$2" | grep type=\"unfinished\" | wc -l` | ||
17 | echo ${csUnfinished}", that means `expr ${csUnfinished} \* 100 / ${csTotal}`% needs to be done." | ||
18 | else | 8 | else |
19 | echo "'$2' is missing. No stats available!" | 9 | case "${lang}" in |
10 | "all") | ||
11 | clear | ||
12 | printf "\ni18n Statistics for ALL languagecode\n" | ||
13 | lang="." | ||
14 | ;; | ||
15 | "unmaintained"|"xx"|"en") | ||
16 | echo "Specified languagecode not allowed." | ||
17 | exit 1 | ||
18 | ;; | ||
19 | *) | ||
20 | if [ ! -d "${lang}" ]; then | ||
21 | echo "Specified languagecode not avaiable." | ||
22 | exit 1 | ||
20 | fi | 23 | fi |
21 | } | 24 | clear |
22 | 25 | printf "\ni18n statistics for languagecode \"${lang}\"\n\n" | |
23 | # | 26 | echo " .--------- Total strings" |
24 | # Main | 27 | echo " | .----- Unfinished strings" |
25 | # | 28 | echo " | | .- Obsolete strings" |
26 | arg=$1 | 29 | echo " | | | File Name" |
27 | foo=$1 | 30 | echo "--- --- --- -------------------------------------" |
28 | if [ "x${arg}x" = "xx" ]; then | 31 | for file in `ls -1 ${1}/*.ts`; do |
29 | arg="." | 32 | strs=`grep -c 'translation' ${file}` |
30 | foo="all" | 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" | ||