-rwxr-xr-x | i18n/status.sh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/i18n/status.sh b/i18n/status.sh index f7fa219..216523b 100755 --- a/i18n/status.sh +++ b/i18n/status.sh | |||
@@ -1,45 +1,50 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | lang=`basename ${1} 2>/dev/null | tr -d '/'` | 2 | lang=`basename ${1} 2>/dev/null | tr -d '/'` |
3 | [ "x${2}x" = "xunfinishedx" ] && unfinishedonly=y | ||
3 | 4 | ||
4 | if [ "x${lang}x" = "xx" ]; then | 5 | if [ "x${lang}x" = "xx" ]; then |
5 | echo "Usage: `basename ${0}` XX" | 6 | echo "Usage: `basename ${0}` <XX> [unfinished]" |
6 | echo " with XX as a languagecode or \"all\" for all languagecodes." | 7 | echo " with <XX> as a languagecode or \"all\" for all languagecodes." |
8 | echo " If you specify 'unfinished' after the languagecode," | ||
9 | echo " only ts-files with unfinished strings will be shown." | ||
7 | exit 1 | 10 | exit 1 |
8 | else | 11 | else |
9 | case "${lang}" in | 12 | case "${lang}" in |
10 | "all") | 13 | "all") |
11 | clear | 14 | clear |
12 | printf "\ni18n Statistics for ALL languagecode\n" | 15 | printf "\ni18n Statistics for ALL languagecodes\n" |
13 | lang="." | 16 | lang="." |
14 | ;; | 17 | ;; |
15 | "unmaintained"|"xx"|"en") | 18 | "unmaintained"|"xx"|"en") |
16 | echo "Specified languagecode not allowed." | 19 | echo "Specified languagecode not allowed." |
17 | exit 1 | 20 | exit 1 |
18 | ;; | 21 | ;; |
19 | *) | 22 | *) |
20 | if [ ! -d "${lang}" ]; then | 23 | if [ ! -d "${lang}" ]; then |
21 | echo "Specified languagecode not avaiable." | 24 | echo "Specified languagecode not available." |
22 | exit 1 | 25 | exit 1 |
23 | fi | 26 | fi |
24 | clear | 27 | clear |
25 | printf "\ni18n statistics for languagecode \"${lang}\"\n\n" | 28 | printf "\ni18n statistics for languagecode \"${lang}\"\n\n" |
26 | echo " .--------- Total strings" | 29 | echo " .--------- Total strings" |
27 | echo " | .----- Unfinished strings" | 30 | echo " | .----- Unfinished strings" |
28 | echo " | | .- Obsolete strings" | 31 | echo " | | .- Obsolete strings" |
29 | echo " | | | File Name" | 32 | echo " | | | File Name" |
30 | echo "--- --- --- -------------------------------------" | 33 | echo "--- --- --- -------------------------------------" |
31 | for file in `ls -1 ${1}/*.ts`; do | 34 | for file in `ls -1 ${1}/*.ts`; do |
32 | strs=`grep -c 'translation' ${file}` | 35 | strs=`grep -c 'translation' ${file}` |
33 | unfi=`grep -c 'type=\"unfinished\"' ${file}` | 36 | unfi=`grep -c 'type=\"unfinished\"' ${file}` |
34 | obso=`grep -c 'type=\"obsolete\"' ${file}` | 37 | obso=`grep -c 'type=\"obsolete\"' ${file}` |
35 | printf "%3s %3s %3s %s\n" "${strs}" "${unfi}" "${obso}" "${file}" | 38 | if [ ${unfi} -gt 0 -o "x${unfinishedonly}x" = "xx" ]; then |
39 | printf "%3s %3s %3s %s\n" "${strs}" "${unfi}" "${obso}" "${file}" | ||
40 | fi | ||
36 | done | 41 | done |
37 | ;; | 42 | ;; |
38 | esac | 43 | esac |
39 | strs=`find ${lang} -path './unmaintained' -prune -o -path './en' -prune -o -path './xx' -prune -o -name "*.ts" -exec grep 'translation' {} \; | wc -l` | 44 | 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` | 45 | 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` | 46 | 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} | 47 | printf "\n%12s %5s\n" "Total:" ${strs} |
43 | printf "%12s %5s %s\n" "Unfinished:" ${unfi} "[`expr \( ${strs} - ${unfi} \) \* 100 / ${strs}`% done]" | 48 | 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}`%]" | 49 | printf "%12s %5s %s\n\n" "Obsolete:" ${obso} "[`expr ${obso} \* 100 / ${strs}`%]" |
45 | fi | 50 | fi |