Skip to main content

django-ok-language-tools PyPI version

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

Some language tools for Django.

Installation

Install with pip:

$ pip install django-ok-language-tools

Update INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    '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_REDIRECT_EXCLUDE_PREFIXES = (
    '/api/v1/',
    '/uploads/',
    '/static/',
)

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.

Quickstart

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

MIDDLEWARE = [
    ...
    'ok_language_tools.middleware.language_redirect_middleware'
]
  • 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}'

Metadata

Release files for django-ok-language-tools 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ok-language-tools 0.0.4
File Size Uploaded Provenance Actions
django-ok-language-tools-0.0.4.tar.gz 6.2 kB Without provenance Details for django-ok-language-tools-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-ok-language-tools 0.0.4
File Interpreter ABI Platform Actions
django_ok_language_tools-0.0.4-py3-none-any.whl Python 3 none any Details for django_ok_language_tools-0.0.4-py3-none-any.whl

Total release size: 13.6 kB

Release files / django-ok-language-tools-0.0.4.tar.gz

Download URL django-ok-language-tools-0.0.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ce01b6d389a83586d54645b86275edfb77e2f818a44c86fbc04b6b2261ae19e6
BLAKE2b-256 checksum
How to use checksums
b58139fb008d09134aa670d9238cf8584fa23ba31cf69b8bd332e4d272e70b4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / django_ok_language_tools-0.0.4-py3-none-any.whl

Download URL django_ok_language_tools-0.0.4-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5753976b5c449bd5265fb3ded7785bb995c5d46b4a841325cf256ffa734cb696
BLAKE2b-256 checksum
How to use checksums
80a36c17ed49c18eb6c656ef22fccf62f15ad212320593efbbc0cbcca2bf3313
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Security for django-ok-language-tools 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page