diff options
author | Parménides GV <parmegv@sdf.org> | 2014-11-05 16:51:16 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-11-05 16:51:16 +0100 |
commit | 6544b8d32ccf81a6c1d832217642b873be8dc6b7 (patch) | |
tree | b07723b530e20b23ae83de822387f6551ea7f9f4 /app/misc/fetchtranslations.sh | |
parent | 713c3a98f53a6bd1ad94e90f28d3e37d20abfab9 (diff) | |
parent | 5304543ebd60778ad46123cd63142e27627fa150 (diff) |
Merge branch 'bug/Android-5-Lollipop-VPN-fails-#6232' into develop
Diffstat (limited to 'app/misc/fetchtranslations.sh')
-rwxr-xr-x | app/misc/fetchtranslations.sh | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/app/misc/fetchtranslations.sh b/app/misc/fetchtranslations.sh index 3529a646..356748d6 100755 --- a/app/misc/fetchtranslations.sh +++ b/app/misc/fetchtranslations.sh @@ -1,38 +1,36 @@ -#! /bin/sh - +#! /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 + 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 -langtoinclude="ca cs de es et fr hu it ja ko no nl pl ro ru sv tr uk" - -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 -for lang in zh-CN zh-TW id +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 [ $lang = "zh-CN" ] ; then - rlang="zh-rCN" - elif [ $lang = "zh-TW" ] ; then - rlang="zh-rTW" - elif [ $lang = "id" ] ; then - rlang="in" - fi - - echo "Fetch archive for $lang" - fetch http://crowdin.net/download/project/ics-openvpn/$lang.zip - tar -xv -C src/main/res/values-$rlang/ --strip-components 3 -f $lang.zip - rm $lang.zip + if (( ${+langhash[$lang]} )); then + alang=$lang + rlang=${langhash[$lang]} + else + alang=$lang-${lang:u} + rlang=$lang + fi + + mkdir -p src/main/res/values-$rlang/ + echo "$alang -> $rlang" + tar -xv -C src/main/res/values-$rlang/ --strip-components 2 -f ics-openvpn.zip res/values-$alang/ done -rm -v ics-openvpn.zip +rm ics-openvpn.zip |