weblate-butterflysoup2/.po2tl.sh

25 lines
745 B
Bash
Raw Normal View History

2023-01-31 13:23:39 +00:00
#!/usr/bin/env bash
declare -A langnames=( ["es_491"]="spanish" ["pt_BR"]="brazilian_portuguese" ["ru"]="russian" ["pl"]="polish" )
for file in ./translations-*.po; do
file2=${file%.po}
langcc=${file2#\.\/translations\-}
if [[ -z ${langnames[$langcc]} ]]; then
lang=$langcc
2023-01-31 13:50:44 +00:00
else
lang=${langnames[$langcc]}
2023-01-31 13:23:39 +00:00
fi
2023-01-31 13:50:44 +00:00
stats=$(msgfmt --statistics ${file} 2>&1)
2023-01-31 13:23:39 +00:00
numdone=$(echo ${stats%* translated*})
2023-01-31 13:50:44 +00:00
if [[ $numdone -le 5680 ]]; then
2023-01-31 13:23:39 +00:00
continue
fi
msgfmt "$file" -o game.mo
PATH=$(pwd)/renpy:${PATH} RENPY_DIR=$(pwd)/renpy python3 rttk-queerscriptors/mo2tl.py $(pwd)/game-source game.mo ${lang}
zip "${lang}.zip" game-source/game/tl/${lang}/*
mv "${lang}.zip" "/var/www/queer/build/${CI_REPO_NAME}/${lang}.zip"
done