diff options
Diffstat (limited to 'gui/scripts')
| -rwxr-xr-x | gui/scripts/crowdin.sh | 13 | ||||
| -rwxr-xr-x | gui/scripts/update-translations.sh | 15 |
2 files changed, 14 insertions, 14 deletions
diff --git a/gui/scripts/crowdin.sh b/gui/scripts/crowdin.sh index e0a0bad41d..914007ac87 100755 --- a/gui/scripts/crowdin.sh +++ b/gui/scripts/crowdin.sh @@ -1,5 +1,10 @@ #!/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]" @@ -13,7 +18,7 @@ mode=$1 function upload_pot { curl \ - -F "files[/messages.pot]=@locales/messages.pot" \ + -F "files[/messages.pot]=@$LOCALE_DIR/messages.pot" \ $BASE_URL/update-file?key="$CROWDIN_API_KEY" } @@ -26,9 +31,9 @@ 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 {} \; + 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 } diff --git a/gui/scripts/update-translations.sh b/gui/scripts/update-translations.sh index 030d0c78a8..db9d5e7b74 100755 --- a/gui/scripts/update-translations.sh +++ b/gui/scripts/update-translations.sh @@ -3,23 +3,18 @@ # This script creates or updates the existing gettext catalogues using the POT template located # under locales/messages.pot -ROOT_DIR=$(dirname $(dirname "${BASH_SOURCE[0]}")) +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +ROOT_DIR=$( dirname $SCRIPT_DIR ) POT_FILE="$ROOT_DIR/locales/messages.pot" for PO_FILE_DIR in $ROOT_DIR/locales/* ; do if [ -d $PO_FILE_DIR ] ; then - PO_FILE="$PO_FILE_DIR/messages.po" - GITKEEP_FILE="$PO_FILE_DIR/.gitkeep" + LOCALE=$( basename $PO_FILE_DIR ) + PO_FILE="$PO_FILE_DIR/messages-$LOCALE.po" if [ -f $PO_FILE ] ; then - echo "Update $PO_FILE_DIR\c" + echo "Update $PO_FILE" msgmerge --no-fuzzy-matching --update $PO_FILE $POT_FILE - else - if [ -f $GITKEEP_FILE ] ; then - echo "Remove $GITKEEP_FILE to initialize the new translation" - else - msginit --input $POT_FILE --output $PO_FILE --no-translator - fi fi fi done |
