Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Django's builtin i18n support stores the selected language in the session, cooki18n uses cookies instead.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 cooki18n
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 ChangeLog
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
README.rst

django-cooki18n

Django's builtin i18n support stores the selected language in the session. This approach has the following problems:

  • Sessions are created for anonymous users when they switch language
  • It may lead to caching issues (the pages are set to "Vary-Cookie", but in fact the session cookie does not change when the language switches)

The above is captured in the following Django tickets.

This little project aims to be a drop in replacement for Django's i18n so that you can have the language stored in a cookie, which is in line with what ticket 12794 requests.

Installation

Simply follow the Django i18n instructions. However:

  • Use cooki18n.middleware.LocaleMiddleware instead of django.middleware.locale.LocaleMiddleware
  • Use cooki18n.views.set_language instead of django.views.i18n.set_language
  • Use cooki18n.utils.get_language_from_request instead of django.utils.translation.get_language_from_request
Something went wrong with that request. Please try again.