[Answer]-Set session value in Template Django

1πŸ‘

βœ…

I would personnaly use the following view function:

def changeLang(request):
    request.session['lang'] = request.GET['lang'] #'en/' or 'fr/' etc...
    return render_to_response(request.session['lang'] + 'home.html', {}, RequestContext(request))

Where I have my templates folder ready for the different options for lang.
I’m quite aware that django supports internationalization, but it’s always more accurate to build a version for each language, especially if one of them is a Right To Left language, which is my case.

πŸ‘€Bit68

Leave a comment