add dict for cc to renpy names

This commit is contained in:
HackerNCoder 2023-01-31 14:23:39 +01:00
parent 342fb87589
commit f887e70f00
2 changed files with 26 additions and 17 deletions

25
.po2tl.sh Executable file
View file

@ -0,0 +1,25 @@
#!/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=${langnames[$langcc]}
else
lang=$langcc
fi
stats=$(msgfmt --statistics $${file} 2>&1)
numdone=$(echo ${stats%* translated*})
if [ $numdone -le 5680 ]
then
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

View file

@ -7,23 +7,7 @@ pipeline:
- git clone https://lab.encryptionin.space/Queerscriptors/rttk-queerscriptors.git - git clone https://lab.encryptionin.space/Queerscriptors/rttk-queerscriptors.git
- git clone https://lab.encryptionin.space/Queerscriptors/renpy.git - git clone https://lab.encryptionin.space/Queerscriptors/renpy.git
- git clone -b game ${CI_REPO_REMOTE} ./game-source - git clone -b game ${CI_REPO_REMOTE} ./game-source
- > - bash .po2tl.sh
for file in ./translations-*.po; do
file2=$${file%.po}
langcc=$${file2#\.\/translations\-}
if [ "$langcc" = "es_419" ]; then langcc="esla"; fi
stats=$(msgfmt --statistics $${file} 2>&1)
numdone=$(echo $${stats%* translated*})
echo $stats $numdone
if [ $numdone -le 5680 ]
then
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 $${langcc}
zip "$${langcc}.zip" game-source/game/tl/$${langcc}/*
mv "$${langcc}.zip" "/var/www/queer/build/${CI_REPO_NAME}/$${langcc}.zip"
done
volumes: volumes:
- /var/www/queer/build/${CI_REPO_NAME}:/var/www/queer/build/${CI_REPO_NAME} - /var/www/queer/build/${CI_REPO_NAME}:/var/www/queer/build/${CI_REPO_NAME}