X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d80d9682f0487d7858d5a18221cbe68e41d38ad..a1edf3f1a7cff6e6f4d85a4288ca9b1d5cd3b254:/scripts/make-locale-pack?ds=inline diff --git a/scripts/make-locale-pack b/scripts/make-locale-pack index fbc6eba2d..9c8e8a760 100755 --- a/scripts/make-locale-pack +++ b/scripts/make-locale-pack @@ -4,17 +4,11 @@ ME=$0 ROOT=$(git rev-parse --show-toplevel) DST=`mktemp -d`/wl-lokalizacja mkdir -p $DST -MANAGE=$ROOT/wolnelektury/manage.py +MANAGE=$ROOT/manage.py export_po() { - for langdir in $ROOT/wolnelektury/locale/*; do - lang=`basename $langdir` - mkdir -p $DST/$lang - cp -v ${ROOT}/wolnelektury/locale/${lang}/LC_MESSAGES/django.po $DST/${lang}/wolnelektury.po - done - for appdir in $ROOT/apps/*; do app=`basename $appdir` if [ -d $ROOT/apps/$app/locale ]; then @@ -26,6 +20,12 @@ export_po() fi done + for langdir in $ROOT/wolnelektury/locale-contrib/*/; do + lang = `basename $langdir` + mkdir -p "$DST/$lang" + cp -v "${langdir}LC_MESSAGES/django.po" "${DST}/$lang/contrib.po" + done + cp -v ${ROOT}/wolnelektury/static/js/locale.js $DST/locale.js.txt cp -v ${ROOT}/apps/infopages/fixtures/infopages.json $DST/infopages.json @@ -33,21 +33,27 @@ export_po() } -( -cd $ROOT/wolnelektury -echo "Generate po for WL" -$MANAGE makemessages --all -) - ( cd $ROOT/apps for i in *; do - echo "Generate po for app $i" - ( cd $i; $MANAGE makemessages --all; - ) + if [ -e "$i/locale" ]; then + echo "Generate po for app $i" + ( cd $i; $MANAGE makemessages --all; + ) + else + echo "Skipping app $i" + fi done ) +( + pybabel extract -F "$ROOT/babel.cfg" \ + -o "$ROOT/wolnelektury/locale-contrib/django.pot" \ + "`python -c 'import os,allauth; print os.path.dirname(allauth.__file__)'`" + pybabel update -D django -i "$ROOT/wolnelektury/locale-contrib/django.pot" \ + -d "$ROOT/wolnelektury/locale-contrib" +) + export_po PACK=`pwd`/wl-lokalizacja.zip