Multlingual redirect

Posted by israkir on Stack Overflow See other posts from Stack Overflow or by israkir
Published on 2010-03-26T19:09:58Z Indexed on 2010/03/26 19:13 UTC
Read the original article Hit count: 226

I want to ignore the post form in the django's internatonalization.

I am using the django-multilingual app, so I have different fields for different languages in the db.

I come up with this idea: For each language, from the index.html page, redirect to a different url (e.g. /en/ or /de/ or /zh/). And each view of this urls, set the session according to the language like this:

def set_lang_en(request):
   request.session['django_language'] = 'en'
   render_to_response("home.html")

def set_lang_zh(request):
   request.session['django_language'] = 'zh-cn'
   render_to_response("home.html")

Interestingly, this does the job, but if i refresh the page again after redirection (home.html).

Why it is like this? And how can solve this problem either in my direction or other one?

© Stack Overflow or respective owner

Related posts about django

Related posts about internationalization