class translations.middleware.TranslationMiddleware[source]

This subclasses the original django LocaleMiddleware. It is a very simple middleware that parses a request and decides what translation object to install in the current thread context. This allows pages to be dynamically translated to the language the user desires (if the language is available, of course).


Enable the default language if a supported db language can not be resolved.

process_response(request, response)[source]

Override the original method to redirect permanently and facilitate the :func.`translations.urls.translation_patterns` URL redirection logic.

Previous topic

Database Models

Next topic

Utility functions

This Page