Hi list,

I'd like to share how to use zipped Django-1.0 and its
LocaleMiddleWare with django-helper, with you.
I tested it only on my Debian/sid box.

First of all, untar Django archive and go into Django-1.0 directory.

$ tar zxvf Django-1.0.tar.gz
$ cd Django-1.0

Then, remove django/contrib/gis/tests because its very bulky and unnecessary.
$ rm -rf django/contrib/gis/tests

After that, apply attached patch for LocaleMiddleWare to work.
$ patch -p0 </some/where/django-for-gae.diff

Zip it omitting gettext catalogue files because its very bulky too.
$ zip -q django.zip `find django -name .svn -prune -o -type f ! -name
'*.pyc' ! -name '*.[pm]o' -print`
$ du -sk django.zip
964     django.zip
(Yes its less than 1MB.)

Then,  check out the newest django-helper from the svn and copy it as usual.
(revision 64 or higher)

$ cd ..
$ svn export http://google-app-engine-django.googlecode.com/svn/trunk/
google-app-engine-django
$ cp -ar google-app-engine-django yourproject

Lastly, copy your django.zip to your project directory.

$ cp Django-1.0/django.zip yourproject

That's all, but don't forget

1. to make a symlink for SDK.
$ cd yourproject
$ ln -s /some/where/google_appengine ./.google_appengine

2. to enable LocaleMiddleWare in your settings.py.

Then you can use manage.py to handle catalogue files as following:
$ python manage.py makemessages -l ja
$ python manage.py compilemessages

Please enjoy.

Additionally, there is a small i18n issue related to djangoforms.
http://code.google.com/p/googleappengine/issues/detail?id=583

Please star it if you'd like.

Regards,

-- Takashi Matsuo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

diff -uNr django/utils/translation/trans_real.py django-for-gae/utils/translation/trans_real.py
--- django/utils/translation/trans_real.py	2008-08-27 14:10:20.000000000 +0900
+++ django-for-gae/utils/translation/trans_real.py	2008-10-02 20:11:08.000000000 +0900
@@ -155,7 +155,7 @@
         # doesn't affect en-gb), even though they will both use the core "en"
         # translation. So we have to subvert Python's internal gettext caching.
         base_lang = lambda x: x.split('-', 1)[0]
-        if base_lang(lang) in [base_lang(trans) for trans in _translations]:
+        if base_lang(lang) in [base_lang(trans) for trans in _translations] and res:
             res._info = res._info.copy()
             res._catalog = res._catalog.copy()
 
@@ -346,9 +346,8 @@
     """
     global _accepted
     from django.conf import settings
-    globalpath = os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
+    globalpath = os.path.join(settings.ROOT_PATH, 'locale')
     supported = dict(settings.LANGUAGES)
-
     if hasattr(request, 'session'):
         lang_code = request.session.get('django_language', None)
         if lang_code in supported and lang_code is not None and check_for_language(lang_code):

Reply via email to