Skip to main content

Simple language select as custom template tag

Project description

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']
  • Add "django_languageselect" to INSTALLED_APPS

Usage

To use django_languageselect in a project, add it to INSTALLED_APP

INSTALLED_APP  = [
    *INSTALLED_APP,
    'django_languageselect',
]

Add this to your urls.py

urlpatterns = [
    *urlpatterns,
    url(r'^languageselect/', include('django_languageselect.urls')),
]

Use the languageselect tag where you which to show languages list:

{% load languageselect %}

{% languageselect %}

Routes

The only url provided by this application is "languageselect_index". Required GET-parameter is "language", optional GET-parameter is "next". Next contains the named url to redirect after the language change. This parameter is pre-filled with the current page url. Customization

Feel free to use your own template, just add languageselect/layer.html

  • Free software: MIT license

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


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-6.0.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

django_languageselect-6.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_languageselect-6.0.0.tar.gz
Algorithm Hash digest
SHA256 e77180747788d4cce6577a9b592c848d764dde1d0289bd378340ae03bfe0d656
MD5 c11bf5c42f55c10fe9f27234c6942105
BLAKE2b-256 5a9ade46f361e442585eec829ee419034000348e0c535e394860d66ab2646305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_languageselect-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6e764cc815db235b3fb6c82caa0533b0f402e386dc551fca6a94c3ed604b6c6
MD5 6f687202918e0894eb6352962b353313
BLAKE2b-256 57051979764100371043b6daacac87ee8fcf84e7f7c787cb4c84e113fe29e0e3

See more details on using hashes here.

Supported by

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