Re: Set language on per page basis

2010-02-26 Thread Tor Nordam
Thanks a lot, this seems to work like a charm. On Feb 25, 10:45 am, Ian Lewis wrote: > In process_request you have access to the request object which knows > the current path (request.path). You can use that to determine which > language to show the page in. > > Or if you

Re: Set language on per page basis

2010-02-25 Thread Tom Evans
On Wed, Feb 24, 2010 at 8:59 PM, Tor Nordam wrote: > Thank you for your reply, > > Using the {% trans %} method is indeed what I intend to do. But the > problem is how to set the language on a page basis, rather than as an > installation-wide setting, or a user-selectable

Re: Set language on per page basis

2010-02-25 Thread Ian Lewis
BTW: django-cms does something similar to what you are trying to do. You can check out it's implementation here: http://github.com/digi604/django-cms-2.0/blob/master/cms/middleware/multilingual.py 2010/2/25 Ian Lewis : > In process_request you have access to the request

Re: Set language on per page basis

2010-02-25 Thread Ian Lewis
In process_request you have access to the request object which knows the current path (request.path). You can use that to determine which language to show the page in. Or if you are determining the language based on a url parameter you can look at request.GET Ian On Thu, Feb 25, 2010 at 8:24

Re: Set language on per page basis

2010-02-24 Thread Tor Nordam
After doing some further research, I have found the following: By writing a small piece of custom middleware, I can change the value of HTTP_ACCEPT_LANGUAGE. If I add this line to a process_request() request.META['HTTP_ACCEPT_LANGUAGE'] = 'no' then the webpage will be displayed with Norwegian

Re: Set language on per page basis

2010-02-24 Thread Tor Nordam
Thank you for your reply, Using the {% trans %} method is indeed what I intend to do. But the problem is how to set the language on a page basis, rather than as an installation-wide setting, or a user-selectable setting. On Feb 24, 6:55 pm, Timothy Kinney wrote: > I

Re: Set language on per page basis

2010-02-24 Thread Timothy Kinney
I believe you want to use the {% *trans* %} template method. http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/ -Tim On Wed, Feb 24, 2010 at 7:18 AM, Tor Nordam wrote: > I'm currently developing a project for making course webpages at my >

Set language on per page basis

2010-02-24 Thread Tor Nordam
I'm currently developing a project for making course webpages at my university. Essentially, each course would be an instance of the model Course, and each course would then get it's own webpage. However, as some courses are taught in Norwegian, and some in English, I want to use django's