summaryrefslogtreecommitdiff
path: root/update_translation.sh
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-06-02 15:30:59 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commit8247cc2d025024109b513d60ed0082caac385669 (patch)
tree3af8fc0fc241b7b3b158e8b8049f6c6e4b8234b4 /update_translation.sh
parent8a378b5ed5b7869db785c3e7f0924efadc01dee9 (diff)
Add a script to update translations from weblate
Diffstat (limited to 'update_translation.sh')
-rwxr-xr-xupdate_translation.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/update_translation.sh b/update_translation.sh
new file mode 100755
index 0000000..4eb51fa
--- /dev/null
+++ b/update_translation.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+git diff --quiet client/locales client/zgotext.go || { echo "There are local uncommited locale changes, exiting..."; exit 1; }
+
+tempdir=$(mktemp -d --tmpdir=.)
+trap 'rm -rf -- "$tempdir"' EXIT
+
+pushd "$tempdir" >/dev/null
+
+echo "Getting translations..."
+wget -q -O translation.zip "https://hosted.weblate.org/download/eduvpn-common/eduvpn-common/?format=zip"
+unzip -q translation.zip
+
+echo "Copying translations..."
+cp -r eduvpn-common/eduvpn-common/client ../
+
+popd >/dev/null
+
+echo "Checking for changes..."
+git diff --quiet client/locales && { echo "No locale changes, exiting..."; exit 1; }
+
+echo "Regenerating locales with go generate ./..."
+go generate ./...
+git add client/zgotext.go client/locales
+git commit -m "Client: Update translations from Weblate"