I just find out ticket #15902 while searching for completely different thing 
:)

I support storing language into cookie only (as final state) for reasons we 
encountered in our applications:

 - Language is not forgotten when user logs out / is logged out.
   - When this happens with languge in session, whole session is dumped 
including language and any further response is displayed with default 
language. This problem is described in #14825.

 - Language can be changed by GET request.
   - If language is stored in cookie, this avoids #3651 as cookies are only 
part of response and does not change state of session on server.

 - Language can be shared without necessity to share session
   - Language cookie can be not secure, thus shared between `https://` and 
`http://` URL even when session is secured. Also language cookie can be 
shared between subdomains without necesity to share session data e.g. 
`admin.example.com` and `www.example.com`. This would actually need a new 
setting LANGUAGE_COOKIE_DOMAIN.

We do not use cache that much yet, so we have not encouter problems with 
that.

I do not actually see any reason for not storing language into cookie. It 
generally does not contain any private data, your language preferences are 
usually in your HTTP headers anyway or in cookies from other webs you 
visited lately.

Parameters of language cookie could be LANGUAGE_COOKIE_NAME, 
LANGUAGE_COOKIE_DOMAIN, not HTTPONLY and not SECURE. Remaining are path and 
age. Path might be fixed to '/'. So only remaining is age. Given that cookie 
does not contain any private data, it can be hardcoded for 1 year (or other 
reasonable time).

I also like possibility to override language cookie params using kwargs on 
set_language view.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/rN2LFvuSHQMJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to