diff --git a/compile-messages.sh b/compile-messages.sh index bc2e8b7b..8dddd6e3 100755 --- a/compile-messages.sh +++ b/compile-messages.sh @@ -1,11 +1,13 @@ #!/bin/sh . ./etc/translation.vars +export TZ=UTC + if [ $# -ge 1 ] then - TZ=UTC env/bin/pybabel compile -D $1 -d $TRANSDIR + $PYBABEL compile -D $1 -d $TRANSDIR else for domain in $(ls $BABELCFG); do - TZ=UTC env/bin/pybabel compile -D $domain -d $TRANSDIR + $PYBABEL compile -D $domain -d $TRANSDIR done fi diff --git a/etc/translation.vars b/etc/translation.vars index b892c1db..cc7998cc 100644 --- a/etc/translation.vars +++ b/etc/translation.vars @@ -4,3 +4,12 @@ BABELCFG=etc/babel.cfg POTDIR=pots PROJDIR=i2p2www TRANSDIR=$PROJDIR/translations + +if [ -x env/bin/pybabel ]; then + PYBABEL=env/bin/pybabel +elif [ $(which pybabel) ]; then + PYBABEL=$(which pybabel) +else + echo "ERROR: pybabel was not found. Please run setup_venv.sh" >&2 + exit 1 +fi diff --git a/extract-messages.sh b/extract-messages.sh index fb7250d9..d8b7de1e 100755 --- a/extract-messages.sh +++ b/extract-messages.sh @@ -1,20 +1,26 @@ #!/bin/sh . ./etc/translation.vars +export TZ=UTC + if [ ! -e $POTDIR ]; then mkdir $POTDIR fi +# By setting the PYTHONPATH here we can help pybabel find 'our' highlighting +# extension and we can use any pybabel +export PYTHONPATH=i2p2www:$PYTHONPATH + if [ $# -ge 1 ] then - TZ=UTC ./pybabel extract --msgid-bugs-address="http://trac.i2p2.de" \ + $PYBABEL extract --msgid-bugs-address="http://trac.i2p2.de" \ --project=$PROJECT \ --version=$VERSION \ -F $BABELCFG/$1 \ -o $POTDIR/$1.pot $PROJDIR else for domain in $(ls $BABELCFG); do - TZ=UTC ./pybabel extract --msgid-bugs-address="http://trac.i2p2.de" \ + $PYBABEL extract --msgid-bugs-address="http://trac.i2p2.de" \ --project=$PROJECT \ --version=$VERSION \ -F $BABELCFG/$domain \ diff --git a/init-new-po.sh b/init-new-po.sh index 5a021c41..e8395ac2 100755 --- a/init-new-po.sh +++ b/init-new-po.sh @@ -1,10 +1,12 @@ #!/bin/sh . ./etc/translation.vars +export TZ=UTC + if [ $# -ge 1 ] then for domain in $(ls $BABELCFG); do - TZ=UTC env/bin/pybabel init -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR -l $1 + $PYBABEL init -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR -l $1 done else echo "Usage: ./init-new-po.sh lang" diff --git a/update-existing-po.sh b/update-existing-po.sh index d423360d..4ddedef2 100755 --- a/update-existing-po.sh +++ b/update-existing-po.sh @@ -1,11 +1,12 @@ #!/bin/sh . ./etc/translation.vars +export TZ=UTC if [ $# -ge 1 ] then - TZ=UTC env/bin/pybabel update -D $1 -i $POTDIR/$1.pot -d $TRANSDIR + $PYBABEL update -D $1 -i $POTDIR/$1.pot -d $TRANSDIR else for domain in $(ls $BABELCFG); do - TZ=UTC env/bin/pybabel update -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR + $PYBABEL update -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR done fi