Opened 15 years ago
Closed 14 years ago
#13819 closed (wontfix)
django.conf.urls.i18n must allow param language as GET
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Translations | Version: | dev |
Severity: | Keywords: | i18n, set_language, get, post | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The description of the set_language method :
Since this view changes how the user will see the rest of the site, it must only be accessed as a POST request. If called as a GET request, it will redirect to the page in the request (the 'next' parameter) without changing any state.
Is not fully correct, in which reason the language must be only given by POST?
This force to be form (or doing an ajax hack) and it's not possible with links.
I don't know many users that will try the ?language=fail just to see what happens, and the ones that do that know how to revert it.
In my mind (and for many others django users for sure), forcing the language to be given in POST make the whole i18n changing language more difficult than the tiny possibility for a user to change the ux in a mess.
I would be pleased to know more about the why :)
This force to be form (or doing an ajax hack) and it's not possible with links.
Which is pretty much the point of it. When you change the language you change the state of the application and therefor this should be handled using HTTP POST instead of HTTP GET. You don't fetch new data but change it. If you take a look at the django-users mailinglist, you will see that this has been discussed quite a lot. Just a few examples:
You can also find some more details in the original ticket: #3651
If you don't like the form approach, you can easily create your own view that handles the language switch via GET (although that goes against the specs) or go with solutions like http://code.google.com/p/django-localeurl/ et al.