Simple language select as custom template tag
"django.middleware.locale.LocaleMiddleware"
inMIDDLEWARE_CLASSES
/MIDDLEWARE
"django.core.context_processors.request"
inTEMPLATE_CONTEXT_PROCESSORS
/TEMPLATES['OPTIONS']['context_processors']
- Add
"django_languageselect"
toINSTALLED_APPS
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 %}
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 will be automatically run by travis on commit to master.
They can also be executed locally using docker-compose by running docker-compose up
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)