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

bumpversion is used to manage releases.

Add your changes to the HISTORY_ and run docker-compose run --rm python bumpversion <major|minor|patch>, then push (including tags)

History

5.0.1 (2024-06-27)

  • Remove support for Python below 3.10
  • Remove support for Django below 4.2
  • Add support for Django 5.0
  • Add support for Python 3.11
  • Add support for Python 3.12
  • Modernize build and test environment

5.0.0 (2024-06-27)

Not released to due an issue with the deploy action

4.0.1 (2023-01-02)

  • Remove support for Django < 3.2
  • Remove support for Python < 3.8
  • Modernize build and test environment

4.0.0 (2023-01-02)

Not released to due an issue with the deploy action

3.0.0 (2021-05-05)

  • Remove support for Django 2.x
  • Remove utf 8 headers as all Python 3 files must be unicode anyways
  • Fix CI badge in readme
  • Modernize build and test environment

2.0.2 (2021-05-05)

  • Remove setting language in session as this was depreacted since Django 2.x and is broken with Django 3.x
  • Add tests for Django 3.2
  • Remove old python 2 and Django compatibility code

2.0.1 (2021-03-25)

  • Fix documentation syntax

2.0.0 (2021-03-25)

  • Update packages
  • Update Docker env
  • Remove support for Django < 2.2

1.0.0 (2019-11-04)

  • Update packages
  • Remove Python 2 support
  • Add docker container to run tests locally

0.1.6 (2018-01-27)

  • Add missing folders and modules from package

0.1.5 (2018-01-15)

  • Add support for python 3 and Django 2, impleneting tests in travis ci

0.1.4 (2017-04-18)

  • Rename package to django_languageselect (backwards incompatible) to be able to import the module

0.1.3 (2016-06-17)

  • Fix session key to store language, Django 1.9 compatibility

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

Uploaded Source

Built Distribution

django_languageselect-5.0.1-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: django_languageselect-5.0.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for django_languageselect-5.0.1.tar.gz
Algorithm Hash digest
SHA256 42873adf9466e246133a01618a7ba6ae3ed24e8f82d983ce1f9ad261a0b8b89b
MD5 40d39f73598ed07bf9105fced9e95a24
BLAKE2b-256 9836c79e959df498a830b20b524d2fa43dd4bd45a17945a588ed609184bd45ea

See more details on using hashes here.

File details

Details for the file django_languageselect-5.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_languageselect-5.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93a72be2f61479adb7e71608b85d5e18f568a267abc15ccee65c72d0a7de1d28
MD5 cde7baea1b4aa5dd23be027ab060444e
BLAKE2b-256 17308e22fc427087881176a88419ddc9b3f29219d76d9c3212ffab6be0381228

See more details on using hashes here.

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