convert some more ssi to template fragment cache
[wolnelektury.git] / scripts / save-locale-pack
1 #!/bin/bash
2
3 ME=$0
4 ROOT=$(git rev-parse --show-toplevel)
5 MANAGE=$ROOT/manage.py
6
7 LOCALIZED=$1
8 if [ ! -d "$LOCALIZED" ]; then
9     echo "$0 w-lokalizacje [lang]"
10     exit 1
11 fi
12 LNG=$2
13
14 load_lang()
15 {
16     L=$1
17     for pofile in "$LOCALIZED/$L/"*.po; do
18         app=`basename "$pofile" .po`
19         echo $app
20         if [ "$app" = "contrib" ]; then
21             cp -v "$pofile" "$ROOT/wolnelektury/locale-contrib/$L/LC_MESSAGES/django.po"
22         else
23             cp -v "$pofile" "$ROOT/apps/$app/locale/$L/LC_MESSAGES/django.po"
24         fi
25     done
26 }
27
28 if [ -n "$LNG" ]; then
29     load_lang $LNG
30 else
31     echo "remember to update language list in this script"
32     for l in pl de en lt fr ru es uk jp it; do
33         load_lang $LNG
34     done
35 fi
36
37 cp -v ${ROOT}/apps/infopages/fixtures/infopages.json "$LOCALIZED/infopages.json"
38 ${0}-json.py "$LOCALIZED/infopages.json" $LNG
39 if [ ! "$?" = 0 ]; then
40     exit 1;
41 fi
42 cp -v "$LOCALIZED/infopages.json" ${ROOT}/apps/infopages/fixtures/infopages.json
43 cp -v "$LOCALIZED/locale.js.txt" ${ROOT}/wolnelektury/static/js/locale.js
44
45 for i in $ROOT/apps/*; do 
46     cd $i;
47     env PYTHONPATH=$ROOT ${VIRTUAL_ENV}/bin/django-admin.py compilemessages --settings=wolnelektury.settings
48 done
49 pybabel compile -D django -d $ROOT/wolnelektury/locale-contrib