Simple language select as custom template tag
Project description
django_languageselect
Simple language select as custom template tag
Requirements
"django.middleware.locale.LocaleMiddleware"inMIDDLEWARE_CLASSES/MIDDLEWARE"django.core.context_processors.request"inTEMPLATE_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
languageis 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_languageselect-8.0.0.tar.gz.
File metadata
- Download URL: django_languageselect-8.0.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0484ec03cf0496e1d64f28e18d66c635457056ae525a59084dbc335b4f57165
|
|
| MD5 |
72e4e7daa79eb8687650e2f20353b27f
|
|
| BLAKE2b-256 |
ea0389b67dd1eb41c8532f9248482d7ca3bdb5d1c939dabc1a859d7239cec2f7
|
File details
Details for the file django_languageselect-8.0.0-py3-none-any.whl.
File metadata
- Download URL: django_languageselect-8.0.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab90216cb5f9fcd28d5d6f17e62dab68b0817a915f1e0f587a665cdab4cca547
|
|
| MD5 |
3cdd46aa9b558e01382029104fc725d5
|
|
| BLAKE2b-256 |
1afe5581da7dfa08fe312099dfb90129aecd3fe94736d1a59d031a86aa8673b6
|