As far as I've understood: the language cookie and the language variable in the session are different things.
And in the session all underscore prefixed variables are reserved by Django. That is the reason why they changed django_language to _language, to be more consistent. Current dev version of Django already dropped compatibility support for 'django_language'.
You're right of course; forgot that there is both a cookie and a session var.
Is this change actually necessary for LocaleURLMiddleware to function with newer Django, or is it simply a theoretical matter of maintaining consistency with the behavior of Django's LocaleMiddleware? Unless I remember wrong (I'm afraid I am a bit rusty on localeurl as I haven't used it recently), LocaleURLMiddleware is intended as a replacement for LocaleMiddleware, so it shouldn't really matter if they use a different session var (except in that it would cause users to lose their language setting if a site switches from using LocaleURLMiddleware to LocaleMiddleware or vice versa, which I guess is a small issue).
Well, my main goal was to get rid of infinite loop of redirection in python 3... b'b'b'b'b'b'b'''''''''... which was caused by encode, which was added to avoid u'u'u'u'u''''' loop in python 2.
six.u() replaced ordinary u'' prefix cause 3.0-3.2 versions are still default python3 on many systems.
I think to duplicate the soft-upgrade behavior is the best way to go, cause if it started to be more LocaleMiddleware compatible by naming variable django_language, then it has to be fully compatible or we better rename it to django_localeurl_language.
I will gladly rethink and redo my pull request closer to the weekend.
Unfortunately this PR currently breaks several tests on Python 2, and isn't sufficient to make the tests pass on Python 3. I think the changes needed may not be major, but I don't have time to dig into it further right away. If you are able to update it such that the tests pass, I will gladly merge it.
Easiest way to run the tests on all supported environments is to pip install tox and then run tox (this requires that you have python2.6, python2.7, python3.3, and python3.4 on your shell PATH). Here is the diff necessary to add Python 3.3 and 3.4 to the tox.ini file: https://gist.github.com/carljm/11015570