django Internation doesn't work by using Django 1.0 with Zipimport

7 views
Skip to first unread message

qubic

unread,
Oct 20, 2008, 6:59:51 AM10/20/08
to Google App Engine
http://code.google.com/appengine/articles/django10_zipimport.html
I follow the steps to make django.zip work in GAE,but i found django
international doesn't work

Rafal Jonca

unread,
Oct 20, 2008, 9:55:10 AM10/20/08
to Google App Engine
Hi,

If you want to get I18N to work, you must have locale dir from django/
conf not in ZIP file but as standard, external files. Then use
LOCALE_DIR in settings.py to tell django where they are. I tried this
in my project and it works.

Regards,
Rafał Jońca

trackmap

unread,
Oct 20, 2008, 10:45:42 AM10/20/08
to Google App Engine
First, you'll have to provide django's locale tree along with your
application files and add an entry in settings.LOCALE_PATHS for it. In
your settings.py:

import os
appdir = os.path.abspath(os.path.dirname(__file__))
LOCALE_PATHS = (
os.path.join(appdir, 'i18n', 'locale'),
)

The above assumes an i18n directory at the same level as your
settings.py file, containing a locale directory with django's
internationalization files.

Next, if you also want support for
django.middleware.locale.LocaleMiddleware, you need to execute the
following lines in your main.py file, just after calling
InstallAppengineHelperForDjango():

from django.conf import settings
sys.modules[settings.__module__].__file__ = os.path.join(
os.path.dirname(settings.LOCALE_PATHS[0]), '__init__.py'
)

I added this just before calling main()

qubic

unread,
Oct 21, 2008, 9:12:02 AM10/21/08
to Google App Engine
Thank you very much,it works!
Reply all
Reply to author
Forward
0 new messages