diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-05-14 10:24:25 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-05-14 10:24:25 +0200 |
| commit | 7c94b962f33f068b73c4d0bb605057e3143f1df8 (patch) | |
| tree | e8eda9a5cabd4fe72205c1f606fcca70af02b5e1 /gui | |
| parent | 80d6b6af2edcf1a252b772d9693da02cfadb9e2b (diff) | |
| parent | d61fe51d8b8ae639acca64e590770eb8c0500757 (diff) | |
| download | mullvadvpn-7c94b962f33f068b73c4d0bb605057e3143f1df8.tar.xz mullvadvpn-7c94b962f33f068b73c4d0bb605057e3143f1df8.zip | |
Merge branch 'use-crowdin-cli-instead-of-v1-api-which-isnt-available-des-838'
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/crowdin.yml | 20 | ||||
| -rwxr-xr-x | gui/scripts/crowdin.sh | 51 |
2 files changed, 20 insertions, 51 deletions
diff --git a/gui/crowdin.yml b/gui/crowdin.yml new file mode 100644 index 0000000000..853d584a56 --- /dev/null +++ b/gui/crowdin.yml @@ -0,0 +1,20 @@ +# Usage: +# crowdin upload sources +# crowdin download + +'project_id': '350815' +'api_token_env': 'CROWDIN_API_KEY' +'base_path': './locales' +'base_url': 'https://api.crowdin.com' +'preserve_hierarchy': true + +files: [ + { + 'source': '/*.pot', + 'translation': '/%osx_locale%/%file_name%.po', + 'translation_replace': { + 'zh-Hans': 'zh-CN', + 'zh-Hant': 'zh-TW', + }, + }, +] diff --git a/gui/scripts/crowdin.sh b/gui/scripts/crowdin.sh deleted file mode 100755 index 74f324bfd2..0000000000 --- a/gui/scripts/crowdin.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -set -e - -BASE_URL=https://api.crowdin.com/api/project/mullvad-app -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -ROOT_DIR=$( dirname "$SCRIPT_DIR" ) -LOCALE_DIR="$ROOT_DIR/locales" - -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]=@$LOCALE_DIR/messages.pot" \ - -F "files[/relay-locations.pot]=@$LOCALE_DIR/relay-locations.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 -d "$LOCALE_DIR" - find "$LOCALE_DIR" -type d -exec chmod 755 {} \; - find "$LOCALE_DIR" -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 |
