40 lines
808 B
Bash
Executable File
40 lines
808 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# 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.
|
|
#
|
|
|
|
set -e
|
|
|
|
proj=anki
|
|
|
|
if [ "$key" = "" ]; then
|
|
echo "key not defined"
|
|
exit 1
|
|
fi
|
|
|
|
if ! git diff-index --quiet HEAD --; then
|
|
echo "working directory is not clean"
|
|
exit 1
|
|
fi
|
|
|
|
# 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 translations' || true
|
|
git push
|