mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-05-06 05:44:37 +08:00
64 lines
1.7 KiB
Bash
Executable file
64 lines
1.7 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=weblate.settings_test
|
|
|
|
version=`python -c 'import weblate; print(weblate.VERSION_BASE)'`
|
|
|
|
# Lock Weblate
|
|
wlc lock weblate/application
|
|
wlc lock weblate/javascript
|
|
wlc lock weblate/documentation
|
|
|
|
# Push changes from Weblate to GitHub
|
|
wlc push weblate
|
|
|
|
# Update Weblate remote
|
|
git remote update weblate
|
|
|
|
# Pull changes from GitHub
|
|
git rebase --onto weblate/master
|
|
|
|
# Update po files itself
|
|
./manage.py makemessages --keep-pot -a -i 'data/*' -i 'docs/*' -i 'examples/*' -i 'build/*'
|
|
./manage.py makemessages --keep-pot -a -i 'data/*' -i 'docs/*' -i 'examples/*' -i 'build/*' -d djangojs
|
|
|
|
# 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/weblate/issues\\n"@' \
|
|
-e 's/"Project-Id-Version:.*/"Project-Id-Version: Weblate '$version'\\n"/' \
|
|
weblate/locale/*/*/*.po weblate/locale/*.pot
|
|
|
|
# Include translations from Django
|
|
for locale in weblate/locale/*/LC_MESSAGES/django.po ; do
|
|
code=${locale#weblate/locale/}
|
|
code=${code%/LC_MESSAGES/django.po}
|
|
file=~/work/django/django/conf/locale/$code/LC_MESSAGES/django.po
|
|
if [ -f $file ] ; then
|
|
msgmerge --previous -C $file -U $locale weblate/locale/django.pot
|
|
fi
|
|
done
|
|
|
|
# Update PO files for documentation
|
|
make -C docs update-po
|
|
|
|
# Commit changes
|
|
git add weblate/locale/*/*/*.po
|
|
git add weblate/locale/*.pot
|
|
git add $(find docs/locales/ -name '*.po' -o -name '*.pot')
|
|
|
|
git commit -n -m "i18n: Update PO files"
|
|
|
|
# Push changes
|
|
git push
|
|
|
|
# Unlock Weblate
|
|
wlc unlock weblate/application
|
|
wlc unlock weblate/javascript
|
|
wlc unlock weblate/documentation
|