Skip to main content

Some language tools for Django.

Project description

Build status Code health Python versions PyPI downloads Software license Project Status

Some language tools for Django.


Install with pip:

$ pip install django-ok-language-tools



Available settings

LANGUAGE_TOOLS_REDIRECT_TO_QUERY_PARAMETER - Query parameter to get next url for ‘set_language’ view.

LANGUAGE_TOOLS_LANGUAGE_QUERY_PARAMETER - Query parameter to get languge to translate next url for ‘set_language’ view.

LANGUAGE_TOOLS_REDIRECT_EXCLUDE_PREFIXES - Tuple of prefixes to skip redirect for ‘language_redirect_middleware’.

For example:


LANGUAGE_TOOLS_DEFAULT_REDIRECT_LANGUAGE - Language code to redirect for a first user visit.

LANGUAGE_TOOLS_VISITED_SESSION_KEY - Key to store visited state in session.


  • Add ‘language_redirect_middleware’ to the MIDDLEWARE configuration to redirect users to default language during a first visit:

  • To enable ‘set_language’ view, add next URL patterns:

urlpatterns = [
    path('', include('ok_language_tools.urls')),

language_url = reverse('ok-language-tools:set-language')
catalog_url = '/catalog/'
language = 'uk'
set_language_url = f'{language_url}?redirect_to={catalog_url}&language={language}'

# or using HTTP_REFERER
set_language_url = f'{language_url}?language={language}'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ok-language-tools-0.0.3.tar.gz (6.2 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page