prefer the venv pybabel but allow the system one to be used (if found)

This commit is contained in:
kytv
2013-08-31 23:58:20 +00:00
parent ba651ceafb
commit 5c7672eb1c
5 changed files with 27 additions and 7 deletions

View File

@ -1,11 +1,13 @@
#!/bin/sh #!/bin/sh
. ./etc/translation.vars . ./etc/translation.vars
export TZ=UTC
if [ $# -ge 1 ] if [ $# -ge 1 ]
then then
TZ=UTC env/bin/pybabel compile -D $1 -d $TRANSDIR $PYBABEL compile -D $1 -d $TRANSDIR
else else
for domain in $(ls $BABELCFG); do for domain in $(ls $BABELCFG); do
TZ=UTC env/bin/pybabel compile -D $domain -d $TRANSDIR $PYBABEL compile -D $domain -d $TRANSDIR
done done
fi fi

View File

@ -4,3 +4,12 @@ BABELCFG=etc/babel.cfg
POTDIR=pots POTDIR=pots
PROJDIR=i2p2www PROJDIR=i2p2www
TRANSDIR=$PROJDIR/translations 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

View File

@ -1,20 +1,26 @@
#!/bin/sh #!/bin/sh
. ./etc/translation.vars . ./etc/translation.vars
export TZ=UTC
if [ ! -e $POTDIR ]; then if [ ! -e $POTDIR ]; then
mkdir $POTDIR mkdir $POTDIR
fi 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 ] if [ $# -ge 1 ]
then then
TZ=UTC ./pybabel extract --msgid-bugs-address="http://trac.i2p2.de" \ $PYBABEL extract --msgid-bugs-address="http://trac.i2p2.de" \
--project=$PROJECT \ --project=$PROJECT \
--version=$VERSION \ --version=$VERSION \
-F $BABELCFG/$1 \ -F $BABELCFG/$1 \
-o $POTDIR/$1.pot $PROJDIR -o $POTDIR/$1.pot $PROJDIR
else else
for domain in $(ls $BABELCFG); do 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 \ --project=$PROJECT \
--version=$VERSION \ --version=$VERSION \
-F $BABELCFG/$domain \ -F $BABELCFG/$domain \

View File

@ -1,10 +1,12 @@
#!/bin/sh #!/bin/sh
. ./etc/translation.vars . ./etc/translation.vars
export TZ=UTC
if [ $# -ge 1 ] if [ $# -ge 1 ]
then then
for domain in $(ls $BABELCFG); do 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 done
else else
echo "Usage: ./init-new-po.sh lang" echo "Usage: ./init-new-po.sh lang"

View File

@ -1,11 +1,12 @@
#!/bin/sh #!/bin/sh
. ./etc/translation.vars . ./etc/translation.vars
export TZ=UTC
if [ $# -ge 1 ] if [ $# -ge 1 ]
then 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 else
for domain in $(ls $BABELCFG); do 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 done
fi fi