mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-05-28 18:41:27 +08:00
70 lines
2 KiB
Bash
Executable file
Vendored
70 lines
2 KiB
Bash
Executable file
Vendored
#!/bin/sh
|
|
|
|
# Renerates .po files used for translating Weblate
|
|
|
|
# Exit on failure
|
|
set -e
|
|
|
|
version=`DJANGO_SETTINGS_MODULE=weblate.settings_example python -c 'import weblate; print(weblate.VERSION_BASE)'`
|
|
|
|
# Lock Weblate
|
|
wlc lock weblate/master
|
|
wlc lock weblate/javascript
|
|
wlc lock weblate/languages
|
|
|
|
# Push changes from Weblate to GitHub
|
|
wlc push weblate
|
|
|
|
# Pull changes from GitHub
|
|
git pull --rebase
|
|
|
|
# Update po files itself
|
|
export DJANGO_SETTINGS_MODULE=weblate.settings_test
|
|
./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: weblate@lists.cihar.com\\n"/' \
|
|
-e 's/"Project-Id-Version:.*/"Project-Id-Version: Weblate '$version'\\n"/' \
|
|
weblate/locale/*/*/*.po weblate/locale/*.pot \
|
|
weblate/langdata/locale/*/*/*.po weblate/langdata/locale/*.pot
|
|
|
|
# Include language names from CLDR
|
|
for locale in weblate/langdata/locale/*/LC_MESSAGES/django.po ; do
|
|
code=${locale#weblate/langdata/locale/}
|
|
code=${code%/LC_MESSAGES/django.po}
|
|
file=scripts/language-data/languages-po/$code.po
|
|
if [ -f $file ] ; then
|
|
msgmerge --previous -C $file -U $locale weblate/langdata/locale/django.pot
|
|
fi
|
|
done
|
|
|
|
# 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
|
|
|
|
# Commit changes
|
|
git add weblate/locale/*/*/*.po
|
|
git add weblate/locale/*.pot
|
|
git add weblate/langdata/locale/*/*/*.po
|
|
git add weblate/langdata/locale/*.pot
|
|
|
|
git commit -s -m "Update po files
|
|
|
|
[CI skip]"
|
|
|
|
# Push changes
|
|
git push
|
|
|
|
# Unlock Weblate
|
|
wlc unlock weblate/master
|
|
wlc unlock weblate/javascript
|
|
wlc unlock weblate/languages
|