Add language chooser

This commit is contained in:
Skia 2016-08-24 19:11:09 +02:00
parent f2c3c7dc25
commit a4df1ae9a5
3 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,16 @@
<div id="popupheader">{{ user.get_display_name() }}</div> <div id="popupheader">{{ user.get_display_name() }}</div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
<div id="language_chooser">
{% for language in LANGUAGES %}
<form action="{{ url('set_language') }}" method="post">{% csrf_token %}
<input name="language" value="{{ language[0] }}" type="hidden" />
<input type="submit" value="{{ language[1]}}" />
</form>
{% endfor %}
</div>
{% block nav %} {% block nav %}
{% if not popup %} {% if not popup %}
<nav> <nav>

View File

@ -156,6 +156,11 @@ DATABASES = {
LANGUAGE_CODE = 'fr-FR' LANGUAGE_CODE = 'fr-FR'
LANGUAGES = [
('en', _('English')),
('fr', _('French')),
]
TIME_ZONE = 'Europe/Paris' TIME_ZONE = 'Europe/Paris'
USE_I18N = True USE_I18N = True

View File

@ -33,5 +33,6 @@ urlpatterns = [
url(r'^api/v1/', include('api.urls', namespace="api", app_name="api")), url(r'^api/v1/', include('api.urls', namespace="api", app_name="api")),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^ajax_select/', include(ajax_select_urls)), url(r'^ajax_select/', include(ajax_select_urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # TODO: remove me for production!!! ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # TODO: remove me for production!!!