Hello,
Sometimes ago I try to solve a similar problem, it seems to me that
the solution to your problem is to write a middleware.
You will find an example there :
http://yml-blog.blogspot.com/search/label/Django
-------------------8<------------------------
from django.utils.cache import patch_vary_headers
from django.utils import translation
class MultilingualURLMiddleware:
def get_language_from_request (self,request):
# This is the place where you should write
# the logic to find the right language
lang = user.language # <= May be something like
return lang
def process_request(self, request):
from django.conf import settings
language = self.get_language_from_request(request)
if language is None:
language = settings.LANGUAGE_CODE[:2]
translation.activate(language)
request.LANGUAGE_CODE = translation.get_language()
def process_response(self, request, response):
patch_vary_headers(response, ("Accept-Language",))
translation.deactivate()
return response
----------8<----------------------
I hope that help.
--yml
On Jul 18, 2:01 pm, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> You could use "user profiles" which will allow you to store various user
> specific preferences. See [1] to learn how to do this.
>
> I am currently using profiles to identify users by the department they work
> in and the last time they edited a form (this is different from last login).
>
> Best,
>
> R
>
> [1] -http://www.djangoproject.com/documentation/authentication/#storing-ad...
>
> On Thu, Jul 17, 2008 at 6:32 PM, Torsten Bronger <
>
> [EMAIL PROTECTED]> wrote:
>
> > Hallöchen!
>
> > In my Web application, every user has to log in. In an additional
> > user database table, the prefered language of each user is given.
> > But how do I activate it?
>
> > I use django.contrib.auth.views.login for the login. However, as
> > far as I can see, I have to copy-and-paste this function and add a
> > line to it which stors the language in the current session. Am I
> > right?
>
> > Tschö,
> > Torsten.
>
> > --
> > Torsten Bronger, aquisgrana, europa vetus
> > Jabber ID: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---