Commit 8a264f04 authored by Daniel STAN's avatar Daniel STAN

draft d'interface de choix de la langue

parent 7e510f3b
......@@ -4,6 +4,7 @@
import os
import sys
import socket
from django.utils.translation import ugettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
......@@ -116,6 +117,12 @@ SITE_ID = 1
# to load the internationalization machinery.
USE_I18N = True
LANGUAGES = [
('fr', _(u'Français')),
('en', _(u'Anglais')),
]
DEFAULT_LANGUAGE = 1
# Formate les dates en fonction de la localisation
USE_L10N = True
......@@ -142,6 +149,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
......
......@@ -31,7 +31,8 @@ urlpatterns = patterns('',
logout_url,
(r'^admin/', include(admin.site.urls)),
(r'^heartbeat$', 'bw_comp.heartbeat.view'),
)
url(r'^i18n/', include('django.conf.urls.i18n')),
)
for app in settings.INTRANET_APPS:
app_name = app["name"]
......
{% load i18n %}
<!DOCTYPE html>
<html lang="fr">
<head>
......@@ -37,6 +38,18 @@
<a tabindex="0" href="{% url 'admin:index' %}">Backend</a>
</li>
{% endif %}
<li>
<form method="POST" action="{% url 'set_language' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.get_full_path }}" />
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<input type="submit" name="language" value="{{ language.code }}" class="{% if language.code == LANGUAGE_CODE %}button-add{% endif %}" />
{% endfor %}
</form>
</li>
<li id="user_menu">
{% if user.is_authenticated %}
<a tabindex="0" id="user_name">{{ user.first_name }} {{ user.last_name }}<img src="/static/img/logout_white.svg" alt="Symbole de déconnexion"></a>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment