I'm sorry, saying that I spent hours on the project and then not
supplying information about what I tried was pretty silly.
Sessions are working fine, and request.session['django_language']
outputs the correct language code ('es' or 'en'). I'm using the same
session variable to define what language should be displayed by the
multilingual app, and it's working fine.
Threading is also working, no errors importing it. As for
do_translate, I threw out some info from that earlier, and it seemed
to output what it should (ie the chosen lang), but I will go back to
that and debug it further.
Extracts from my settings.py:
USE_I18N = True
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
LANGUAGES = (
('en', 'English'),
('es', 'Spanish'),
)
LANGUAGE_CODE = 'es'
DEFAULT_LANGUAGE = 2 #For the multilingual app
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'multilingual.context_processors.multilingual',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
'django.contrib.webdesign',
'myproj.myapp',
'multilingual',
)
I render my templates by something along the lines of:
return render_to_response(
'template.html',
{'data': data,},
context_instance=RequestContext(request)
)
//Magnus
On 14 Dec, 18:07, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > Would be much grateful for any kind of hint, I've spent so many hours
> > trying to solve this and I can't figure out what my next move should
> > be.
>
> - Do you have Sessions enabled? If so, do you see the correct language
> when you print request.session['django_language']? Do you have the
> LocaleMiddleware after the SessionMiddleware in settings?
>
> - The i18n framework depends on the Python threading module. If you
> drop into a shell with "python manage.py shell", are you able to
> "import threading"?
>
> - If all of that seems OK, find the "do_translate" function in
> django.utils.translation.trans_real.do_translate and put some debug
> prints there to see why Django may be falling back to
> settings.LANGUAGE_CODE
>
> -Rajesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---