diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-03-07 14:27:29 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-03-08 15:39:54 +0100 |
| commit | 984bb00022c83fb3e6a6c66570dfa73d6a2e653f (patch) | |
| tree | 09117478b60c2dc9a7ed442eab4276fc6b11b280 /gui | |
| parent | 317c917bc0a773ddea5d2a607136d2441797b2dc (diff) | |
| download | mullvadvpn-984bb00022c83fb3e6a6c66570dfa73d6a2e653f.tar.xz mullvadvpn-984bb00022c83fb3e6a6c66570dfa73d6a2e653f.zip | |
Adjust catalogue names to Crowdin and fix the shell script
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/locales/de/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/es/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/fr/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/it/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/ja/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/nl/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/no/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/pt/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/ru/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/sv/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/tr/.gitkeep | 0 | ||||
| -rw-r--r-- | gui/locales/zh/.gitkeep | 0 | ||||
| -rwxr-xr-x | gui/scripts/crowdin.sh | 13 | ||||
| -rwxr-xr-x | gui/scripts/update-translations.sh | 15 | ||||
| -rw-r--r-- | gui/src/shared/gettext.ts | 2 |
15 files changed, 15 insertions, 15 deletions
diff --git a/gui/locales/de/.gitkeep b/gui/locales/de/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/de/.gitkeep +++ /dev/null diff --git a/gui/locales/es/.gitkeep b/gui/locales/es/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/es/.gitkeep +++ /dev/null diff --git a/gui/locales/fr/.gitkeep b/gui/locales/fr/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/fr/.gitkeep +++ /dev/null diff --git a/gui/locales/it/.gitkeep b/gui/locales/it/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/it/.gitkeep +++ /dev/null diff --git a/gui/locales/ja/.gitkeep b/gui/locales/ja/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/ja/.gitkeep +++ /dev/null diff --git a/gui/locales/nl/.gitkeep b/gui/locales/nl/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/nl/.gitkeep +++ /dev/null diff --git a/gui/locales/no/.gitkeep b/gui/locales/no/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/no/.gitkeep +++ /dev/null diff --git a/gui/locales/pt/.gitkeep b/gui/locales/pt/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/pt/.gitkeep +++ /dev/null diff --git a/gui/locales/ru/.gitkeep b/gui/locales/ru/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/ru/.gitkeep +++ /dev/null diff --git a/gui/locales/sv/.gitkeep b/gui/locales/sv/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/sv/.gitkeep +++ /dev/null diff --git a/gui/locales/tr/.gitkeep b/gui/locales/tr/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/tr/.gitkeep +++ /dev/null diff --git a/gui/locales/zh/.gitkeep b/gui/locales/zh/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/gui/locales/zh/.gitkeep +++ /dev/null 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 diff --git a/gui/src/shared/gettext.ts b/gui/src/shared/gettext.ts index 4722e16915..a1e2a3cb0f 100644 --- a/gui/src/shared/gettext.ts +++ b/gui/src/shared/gettext.ts @@ -47,7 +47,7 @@ export function loadTranslations(currentLocale: string) { } function parseTranslation(locale: string, domain: string): boolean { - const filename = path.join(LOCALES_DIR, locale, `${domain}.po`); + const filename = path.join(LOCALES_DIR, locale, `${domain}-${locale}.po`); let buffer: Buffer; try { |
