summaryrefslogtreecommitdiff
path: root/main/misc/fetchtranslations.sh
blob: a26f28e593d8bc5b0408ed163ad18e23b6a4a21e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/zsh
set -o shwordsplit

if [ "$ICSCROWDAPIKEY" != "" ]
then
	echo "Generating new translation archives"
	fetch -q -1 -o - "http://api.crowdin.net/api/project/ics-openvpn/export?key=$ICSCROWDAPIKEY"
fi

echo "Fetch translation archive"
fetch -q http://crowdin.net/download/project/ics-openvpn.zip



for lang in $langtoinclude
do
    tar -xvf ics-openvpn.zip -C src/main res/values-$lang/
done

# Chinese language require zh-CN and zh-TW

typeset -A langhash
langhash=(zh-CN zh-rCN zh-TW zh-rTW id-ID in ca-ES ca cs-CZ cs et-EE et ja-JP ja ko-KR ko sv-SE sv uk-UA uk)

langtoinclude="de es fr hu it no nl pl pt ro ru tr"
for lang in $langtoinclude ${(k)langhash}
do
    if (( ${+langhash[$lang]} )); then
        alang=$lang
        rlang=${langhash[$lang]}
    else
        alang=$lang-${lang:u}
        rlang=$lang
	fi

	tar -xv -C src/main/res/values-$rlang/ --strip-components 3 -f ics-openvpn.zip res/values-$alang/
done

rm -v ics-openvpn.zip