2020-01-02 22:59:00 +01:00
|
|
|
#!/bin/bash
|
2020-01-02 23:24:59 +01:00
|
|
|
#
|
|
|
|
# Pulls the latest translations from crowdin and commits them here.
|
|
|
|
# To use this, key must be set to a crowdin API key.
|
|
|
|
# Aborts if there are any uncommited changes prior to running.
|
|
|
|
#
|
2020-01-02 22:59:00 +01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
proj=anki
|
|
|
|
|
|
|
|
if [ "$key" = "" ]; then
|
|
|
|
echo "key not defined"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-01-02 23:24:59 +01:00
|
|
|
if ! git diff-index --quiet HEAD --; then
|
|
|
|
echo "working directory is not clean"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-01-02 22:59:00 +01:00
|
|
|
# fetch translations from crowdin
|
|
|
|
if [ ! -f all.zip ]; then
|
|
|
|
curl https://api.crowdin.com/api/project/$proj/export?key=$key
|
|
|
|
curl -o all.zip https://api.crowdin.com/api/project/$proj/download/all.zip?key=$key
|
|
|
|
fi
|
|
|
|
|
|
|
|
# unzip
|
|
|
|
unzip -o all.zip
|
|
|
|
|
|
|
|
# make sure translations are valid
|
|
|
|
python check-po-files.py
|
|
|
|
|
|
|
|
rm all.zip
|
|
|
|
|
|
|
|
# send translations to github
|
|
|
|
git add translations
|
|
|
|
git commit -m update || true
|
|
|
|
git push
|