anki/qt/i18n/update-from-crowdin

39 lines
795 B
Plaintext
Raw Normal View History

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
2020-01-04 23:52:46 +01:00
# commit them to the repo
2020-01-02 22:59:00 +01:00
git add translations
2020-01-04 23:35:08 +01:00
git commit -m 'update translations' || true