Code

Opened 4 years ago

Closed 4 years ago

#13819 closed (wontfix)

django.conf.urls.i18n must allow param language as GET

Reported by: anonymous Owned by: nobody
Component: Translations Version: master
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: UI/UX:

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 :)

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by zerok

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.