--- /dev/null
+#!/bin/bash
+
+ME=$0
+ROOT=$(git rev-parse --show-toplevel)
+DST=`mktemp -d`/wl-lokalizacja
+mkdir -p $DST
+MANAGE=$ROOT/wolnelektury/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
+ for langdir in $ROOT/apps/$app/locale/*; do
+ lang=`basename $langdir`
+ mkdir -p $DST/$lang
+ cp -v ${ROOT}/apps/${app}/locale/${lang}/LC_MESSAGES/django.po $DST/${lang}/${app}.po
+ done
+ fi
+ done
+
+ cp -v ${ROOT}/wolnelektury/static/js/locale.js $DST/locale.js.txt
+ cp -v ${ROOT}/apps/infopages/fixtures/infopages.json $DST/infopages.json
+
+ ${0}-json.py $DST/infopages.json
+}
+
+
+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;
+ )
+done
+
+export_po
+
+PACK=`pwd`/wl-lokalizacja.zip
+( cd $DST; cd ..; zip -r $PACK wl-lokalizacja; )
+
+rm -r $DST
+
--- /dev/null
+#!/usr/bin/env python
+
+import json
+import sys
+import os
+import shutil
+
+fname = sys.argv[1]
+def mkdir(n):
+ if not os.path.exists(n): os.mkdir(n)
+
+dst = os.path.dirname(fname)
+name = os.path.basename(fname).split('.')[0]
+
+dst2 = os.path.join(dst, name)
+mkdir(dst2)
+
+data = json.load(open(fname))
+for ip in data:
+ dst3 = os.path.join(dst2, ip['fields']['slug'])
+ mkdir(dst3)
+ for fld, val in ip['fields'].items():
+ if filter(lambda x: fld.startswith(x),
+ ['title', 'left_column', 'right_column']):
+ o = open(os.path.join(dst3, fld+".txt"),'w')
+ try:
+ o.write(val.encode('utf-8'))
+ finally:
+ o.close()
+