Once LocaleMiddleware determines the user’s preference, it makes this preference available asrequest.LANGUAGE_CODE for each HttpRequest.
'django.middleware.locale.LocaleMiddleware',
{{ LANGUAGE_CODE }}: request.LANGUAGE_CODE if it exists; otherwise, the value of the LANGUAGE_CODE setting.