Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
django-user-language-middleware
Advanced tools
User Language Middleware
.. image:: https://travis-ci.org/laura-barluzzi/django-user-language-middleware.svg?branch=master :target: https://travis-ci.org/laura-barluzzi/django-user-language-middleware .. image:: https://img.shields.io/pypi/v/django-user-language-middleware.svg :target: https://pypi.python.org/pypi/django-user-language-middleware/
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!
Add a language field to your user model:
.. code-block:: python
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:
.. code-block:: sh
pip install django-user-language-middleware
and then add it to your middleware class list to listen to requests:
.. code-block:: python
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
...
'user_language_middleware.UserLanguageMiddleware',
...
]
Python:
Django:
FAQs
Django middleware to translate with language in user model
We found that django-user-language-middleware demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.