0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00
Anki-Android/tools/translation-rates.sh
Arthur Milchior 613f6597c8 ensure scripts prints escaped character
On my desktop, running `./tools/storage/set_scopde_storage.sh` led to

> Alienware% ./tools/storage/set_scoped_storage.sh
> First argument missing.
> \nPossible arguments:
> limited\t\tEquivalent to a fresh install. /AnkiDroid/ is inaccessible
> full\t\tEquivalent to an upgrade from targetSdkVersion 29 to 30. /AnkiDroid/ is accessible\n

Adding `-e` ensures the characters are printed as expected.
2023-04-15 14:38:14 -03:00

30 lines
878 B
Bash
Executable File

#!/bin/sh
#
# Shows the completion rate of the translation for each language.
#
wget -O tmp-translations-page.html https://crowdin.net/project/ankidroid --no-check-certificate
cat tmp-translations-page.html |
egrep 'project-language-name|[approved|translated]: \d+%'|
sed -e "s/<strong.*unselectable\">//g"|
sed -e "s/<\/strong>//g" |
sed -e "s/\w*<\/div>//g" |
sed -e "s/[[:space:]]*//g"|
tr "\n" " " |
tr '%' '\n' |
sed -e "s/^ //g" |
sed -e "s/\:/\: /g" |
grep -v "^\s+$" |
sed -e "s/$/%/g" |
grep -v " 0" > tmp-list.txt
echo "By country:"
cat tmp-list.txt | sort
echo -e "\nBy rate approved (implies 100% translated):"
cat tmp-list.txt | grep approved | sed -e "s/\(.*\) \([0-9]*\)%/\2% \1/g" | sort -nr
echo -e "\nBy rate translated:"
cat tmp-list.txt | grep translated | sed -e "s/\(.*\) \([0-9]*\)%/\2% \1/g" | sort -nr
rm -f tmp-translations-page.html tmp-list.txt