Locale Middleware

LocalMiddleware is used to detect the user’s language and it is used to internationalize the application.

The language selected will be based on (by order):

  • The language selected in the language user field.

  • The language selected in the browser.

  • The language selected in LANGUAGE_CODE setting.

How to use

Add it to the MIDDLEWARE list in your Django settings:

MIDDLEWARE = [
    ...,
    'core.middleware.locale.LocaleMiddleware'
]