translation: Don't use session for storing lang pref in Django 4.0
Helps: #2228 (closed).
-
In Django 3.0, storing language preference in session key is deprecated and only the language cookie is used. In Django 4.0, this functionality is completely removed along with the constant LANGUAGE_SESSION_KEY.
-
Debian stable (Bullseye) uses Django 2.2 and this depends on code to store language preference in session key. To work on Django 2.2 through 4.0, check if the constant is available and then set the session key of the constant is found.
Tests:
-
Change language in user edit page and see that it is persisted.
-
After logout, the new language is still set.
-
Changing language as anonymous user works.
-
Run tests in stable, testing and unstable containers.
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org