django-user-language-middleware 0.0.3

Creator: danarutscher

Last updated:

Add to Cart

Description:

djangouserlanguagemiddleware 0.0.3

What’s this?
This package contains a middleware that activates translations based on the
language field in the user model. This enables easy user-specific localization
of a Django application: just add a language string field to the user model,
install this middleware and you’re good to go!


Usage
Add a language field to your user model:
class User(auth_base.AbstractBaseUser, auth.PermissionsMixin):
# ...
language = models.CharField(max_length=10,
choices=settings.LANGUAGES,
default=settings.LANGUAGE_CODE)
Install the middleware from pip:
pip install django-user-language-middleware
and then add it to your middleware class list to listen to requests:
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
...
'user_language_middleware.UserLanguageMiddleware',
...
]


Supported versions
Python:

2.7
3.4 to 3.6

Django:

1.8 to 1.11
2.0

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.