Thanks a lot, this seems to work like a charm. On Feb 25, 10:45 am, Ian Lewis <ianmle...@gmail.com> 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 are determining the language based on a url parameter you > can look at request.GET > > Ian > > > > On Thu, Feb 25, 2010 at 8:24 AM, Tor Nordam <tor.nor...@gmail.com> wrote: > > 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 translation. > > However, I want to set the language based on which page the user is > > trying to view, and process_request() doesn't know this. On the other > > hand, if I use process_view(), I am able to determine what the > > language should be, as process_view() gets passed for example the > > arguments from the url. However, when I add the same line as above to > > process_view(), nothing happens to the language. > > > Is there an easy way to do this? > > > On Feb 24, 9:59 pm, Tor Nordam <tor.nor...@gmail.com> 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 setting. > > >> On Feb 24, 6:55 pm, Timothy Kinney <timothyjkin...@gmail.com> wrote: > > >> > 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 <tor.nor...@gmail.com> wrote: > >> > > 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 internationalisation framework, and I want to be able to > >> > > set the language for each course separately. So I want to use > >> > > different languages, but I don't want the person viewing the webpage > >> > > to be able to select the language himself. > > >> > > As far as I can tell, the standard ways to set the language is either > >> > > to use one setting for you entire project, or to select language based > >> > > on the end users preferences. Is there an easy way to do what I want? > > >> > > -- > >> > > You received this message because you are subscribed to the Google > >> > > Groups > >> > > "Django users" group. > >> > > To post to this group, send email to django-us...@googlegroups.com. > >> > > To unsubscribe from this group, send email to > >> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > >> > > . > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/django-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. > > -- > ======================================= > 株式会社ビープラウド イアン・ルイス > 〒150-0012 > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > email: ianmle...@beproud.jp > TEL:03-5795-2707 > FAX:03-5795-2708http://www.beproud.jp/ > =======================================
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.