Skip to main content

Django middleware for setting the user's language preference at request time.

Project description

Django Language Preference Middleware

This repo contains basic middleware that retrieves a user’s language preference and sets it on the request session.


Subclass LanguagePreferenceMiddleware and override the get_user_language_preference method.

Your new middleware should be tested by including LangPrefMiddlewareTestCaseMixin in your test case and overriding the middleware_class, get_user, and set_user_language_preference attributes.


$ make validate

How to Contribute

Contributions are very welcome, but for legal reasons, you must submit a signed [individual contributor’s agreement]( before we can accept your contribution. See our [CONTRIBUTING]( file for more information – it also contains guidelines for how to maintain high code quality, which will make your contribution more likely to be accepted.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-lang-pref-middleware-1.2.0.tar.gz (8.7 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page