Opened 9 years ago
Closed 9 years ago
#25096 closed Uncategorized (duplicate)
set_language view does not redirect to specified language if next is not set
Reported by: | Carl Marshall | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.8 |
Severity: | Normal | Keywords: | i18n |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Most of what I'm about to say has been documented in more detail on the above stack overflow link.
In short, posting to set_language with a language code and no next value results in the language code being ignored and not changed, because the second step of determining the redirect url does not account for the fact that having i18n urls enabled means that the REFERRER url contains the previous language code, which is what is picked up by the locale middleware first, which then discards the session data saved by set_language in the first place.
I would suggest that this function is modified to remove the language code prefix from the REFERRER url, so that the resulting redirect goes to the current page and with the newly selected language.
Duplicate of #24122, will be fixed in Django 1.9.