mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/hosted.git
synced 2026-05-25 03:13:59 +08:00
47 lines
1.1 KiB
Bash
Executable file
47 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Renerates .po files used for translating Weblate
|
|
|
|
# Exit on failure
|
|
set -e
|
|
|
|
export CI_DATABASE=postgresql
|
|
export DJANGO_SETTINGS_MODULE=wlhosted.settings_test
|
|
|
|
# Lock Weblate
|
|
wlc lock
|
|
|
|
# Push changes from Weblate to GitHub
|
|
wlc push
|
|
|
|
# Update Weblate remote
|
|
git remote update weblate
|
|
|
|
# Pull changes from GitHub
|
|
git rebase --onto weblate/main
|
|
|
|
# Cleanup locale dirs
|
|
find wlhosted/locale \( -name '*.mo' -o -name '*~' \) -delete
|
|
find wlhosted/locale -type d -empty -delete
|
|
|
|
# Update po files itself
|
|
django-admin makemessages --keep-pot -a -i 'data/*' -i 'docs/*' -i 'examples/*' -i 'build/*'
|
|
|
|
# Fix Report-Msgid-Bugs-To as it gets removed
|
|
sed \
|
|
-i \
|
|
-e 's@"Report-Msgid-Bugs-To:.*@"Report-Msgid-Bugs-To: https://github.com/WeblateOrg/hosted/issues\\n"@' \
|
|
-e 's/"Project-Id-Version:.*/"Project-Id-Version: Hosted Weblate\\n"/' \
|
|
wlhosted/locale/*/*/*.po wlhosted/locale/*.pot
|
|
|
|
# Commit changes
|
|
git add wlhosted/locale/*/*/*.po
|
|
git add wlhosted/locale/*.pot
|
|
|
|
git commit -m "i18n: Update PO files"
|
|
|
|
# Push changes
|
|
git push
|
|
|
|
# Unlock Weblate
|
|
wlc unlock
|