summaryrefslogtreecommitdiff
path: root/update_translation.sh
blob: f830e253f959bf6d918e86809d698520ad6f38cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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/eduvpn-common/?format=zip"
unzip -q translation.zip

echo "Copying translations..."
cp -r eduvpn/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"