Add script to pull Crowdin translations

This commit is contained in:
wvengen 2020-02-29 15:33:54 +01:00
parent ecb4a8a4ba
commit 1f34061e3e
1 changed files with 22 additions and 0 deletions

22
script/crowdin-pull Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
PROJECT=foodsoft
if [ ! "${CROWDIN_API_KEY}" ]; then
echo "Please set CROWDIN_API_KEY to download all translations." 1>&2
exit 1
fi
# build archive
wget -q -O/dev/null "https://api.crowdin.com/api/project/${PROJECT}/export?key=${CROWDIN_API_KEY}"
# download all translations
TMPDIR=$(mktemp -d -t "crowdin-${PROJECT}-XXXXXXXXXX")
wget -q -O "${TMPDIR}/all.zip" "https://api.crowdin.com/api/project/${PROJECT}/download/all.zip?key=${CROWDIN_API_KEY}"
# extract, but strip 'master' component
ln -s $(pwd) "${TMPDIR}/master"
unzip -o -d "${TMPDIR}" "${TMPDIR}/all.zip"
rm -f "${TMPDIR}/all.zip" "${TMPDIR}/master"
rmdir "${TMPDIR}"