diff options
| author | Simon Andersson <simon@mullvad.net> | 2019-03-05 10:37:07 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-03-08 15:39:54 +0100 |
| commit | 317c917bc0a773ddea5d2a607136d2441797b2dc (patch) | |
| tree | 1f96f503f6461537b27b3e4e570ee5507fd1c112 /gui | |
| parent | d61d3b989ace19a74fe01673aff9e586f9f08132 (diff) | |
| download | mullvadvpn-317c917bc0a773ddea5d2a607136d2441797b2dc.tar.xz mullvadvpn-317c917bc0a773ddea5d2a607136d2441797b2dc.zip | |
Add script for interacting with CrowdIn
Diffstat (limited to 'gui')
| -rwxr-xr-x | gui/scripts/crowdin.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gui/scripts/crowdin.sh b/gui/scripts/crowdin.sh new file mode 100755 index 0000000000..e0a0bad41d --- /dev/null +++ b/gui/scripts/crowdin.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +BASE_URL=https://api.crowdin.com/api/project/mullvad-app + +if [ $# -ne 1 ]; then + echo "Usage: $0 [upload|export|download]" + exit 1 +elif [ -z "$CROWDIN_API_KEY" ]; then + echo "Need to set environment variable CROWDIN_API_KEY" + exit 1 +fi + +mode=$1 + +function upload_pot { + curl \ + -F "files[/messages.pot]=@locales/messages.pot" \ + $BASE_URL/update-file?key="$CROWDIN_API_KEY" +} + +function export_translations { + curl \ + $BASE_URL/export?key="$CROWDIN_API_KEY" +} + +function download_translations { + wget \ + --content-disposition \ + $BASE_URL/download/all.zip?key="$CROWDIN_API_KEY" + unzip -o all.zip + find locale -type d -exec chmod 755 {} \; + find locale -type f -exec chmod 644 {} \; + rm all.zip +} + +if [[ $mode == "upload" ]]; then + upload_pot +elif [[ $mode == "export" ]]; then + export_translations +elif [[ $mode == "download" ]]; then + download_translations +else + echo "'$mode' is not a valid mode" + echo "Usage: $0 [upload|export|download]" + exit 1 +fi |
