update locale scripts
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 20 Mar 2012 13:47:36 +0000 (14:47 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 20 Mar 2012 13:47:36 +0000 (14:47 +0100)
scripts/make-locale-pack
scripts/save-locale-pack

index 81d6d9a..f7adc02 100755 (executable)
@@ -9,12 +9,6 @@ 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
@@ -26,7 +20,7 @@ export_po()
        fi
     done
 
-    for langdir in $ROOT/locale-contrib/*/; do
+    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"
@@ -39,24 +33,25 @@ 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/locale-contrib/django.pot" \
-         "`python -c 'import os,allauth; print os.path.dirname(allauth.__file__)'`"
+    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
index 3e1aa52..1d14068 100755 (executable)
@@ -17,8 +17,8 @@ load_lang()
     for pofile in "$LOCALIZED/$L/"*.po; do
        app=`basename "$pofile" .po`
        echo $app
-       if [ "$app" = "wolnelektury" ]; then
-           cp -v "$pofile" "$ROOT/wolnelektury/locale/$L/LC_MESSAGES/django.po"
+       if [ "$app" = "contrib" ]; then
+           cp -v "$pofile" "$ROOT/wolnelektury/locale-contrib/$L/LC_MESSAGES/django.po"
        else
            cp -v "$pofile" "$ROOT/apps/$app/locale/$L/LC_MESSAGES/django.po"
        fi
@@ -46,5 +46,4 @@ for i in $ROOT/apps/*; do
     cd $i;
     env PYTHONPATH=$ROOT ${VIRTUAL_ENV}/bin/django-admin.py compilemessages --settings=wolnelektury.settings
 done
-cd $ROOT/wolnelektury
-env PYTHONPATH=$ROOT ${VIRTUAL_ENV}/bin/django-admin.py compilemessages --settings=wolnelektury.settings
+pybabel compile -D django -d $ROOT/wolnelektury/locale-contrib