https://github.com/pennersr/django-cooki18n
Django's builtin i18n support stores the selected language in the session, cooki18n uses cookies instead.
https://github.com/pennersr/django-cooki18n
Last synced: 6 months ago
JSON representation
Django's builtin i18n support stores the selected language in the session, cooki18n uses cookies instead.
- Host: GitHub
- URL: https://github.com/pennersr/django-cooki18n
- Owner: pennersr
- License: mit
- Created: 2011-06-07T18:23:48.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2016-12-04T17:28:13.000Z (almost 9 years ago)
- Last Synced: 2025-03-24T22:51:21.342Z (7 months ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 12
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: ChangeLog
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
===============
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.
- https://code.djangoproject.com/ticket/12794
- https://code.djangoproject.com/ticket/15902This 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``