I need to include two buttons or links to allow users change language between English and Spanish. I\'ve read the docs and tried this:
Besides adding form that was suggested here:
I would suggest adding a context processor (app.context_processors.py):
def language_processor(request):
"""
This is needed for language picker to work
"""
return {
'languageless_url':
'/' + '/'.join(request.get_full_path().split('/')[2:])
}
This allows to leave the logic out of template. Also don't forget to add your processor in template settings:
'context_processors': [
'app.context_processors.language_processor',