GithubHelp home page GithubHelp logo

sandlbn / django-cooki18n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pennersr/django-cooki18n

0.0 2.0 0.0 64 KB

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

License: MIT License

django-cooki18n's Introduction

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

django-cooki18n's People

Contributors

pennersr avatar pkatseas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.