Skip to main content

django_languageselect

PyPI PyPI

Simple language select as custom template tag

Requirements

  • "django.middleware.locale.LocaleMiddleware" in MIDDLEWARE_CLASSES / MIDDLEWARE
  • "django.core.context_processors.request" in TEMPLATE_CONTEXT_PROCESSORS / TEMPLATES['OPTIONS']['context_processors']

Usage

To use django_languageselect in a project, add it to INSTALLED_APPS

INSTALLED_APPS = [
    *INSTALLED_APPS,
    "django_languageselect",
]

Then add its endpoint to your urls.py. It's important to keep the languageselect_index name when using the provided template tag!

from django.urls import path

from django_languageselect.views import IndexView

urlpatterns = [
    path("languageselect", IndexView.as_view(), name="languageselect_index"),
]

Use the languageselect template tag where you wish to show the language selection:

{% load languageselect %}

{% languageselect %}

This will render all languages in your LANGUAGES setting to select from.

Parameters

  • language is the only required parameter expecting a two-letter ISO 639 language code.
  • next - optionally pass the URL to redirect to after the language has been changed. The template tag redirects to the current URL.

Customization

Feel free to use your own template, just add languageselect/layer.html to the template folder of an app that is earlier in your INSTALLED_APPS than django_languageselect.

Tests

Tests will be automatically run by travis on commit to master.

They can also be executed locally using docker-compose by running docker-compose up

Making a new release

This project makes use of RegioHelden's reusable GitHub workflows.
Make a new release by manually triggering the Open release PR workflow.

Download files

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

Source Distribution

django_languageselect-8.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_languageselect-8.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file django_languageselect-8.1.0.tar.gz.

File metadata

  • Download URL: django_languageselect-8.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_languageselect-8.1.0.tar.gz
Algorithm Hash digest
SHA256 b03413c6da79513aab46a1a18aeb83e39c0115ce040c64ea16457098f939c537
MD5 f30fb3f35e6cd85344850a1f646571a8
BLAKE2b-256 1f54526a1a21a20b2222c250855bc9aa33cb82d4984deed013163c7f88d74afe

See more details on using hashes here.

File details

Details for the file django_languageselect-8.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_languageselect-8.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_languageselect-8.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 388a212a721299f7a0fd97ccbbfa48070c4ee0a86990f167ba39ecea5f9ff3c7
MD5 cdfe8e307c9c3d96c43dc553103bc010
BLAKE2b-256 7104d2e3c76446f80ae1ac8d7c9776f645cb88d17bc10d24802d73f570109f0c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

8.1.0 This release

2 files

8.0.0

2 files

7.0.0

2 files

6.0.0

2 files

5.0.1

2 files

4.0.1

2 files

3.0.0

2 files

2.0.2

2 files

2.0.1

2 files

0.1.6

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

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