Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
intranet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nounous-archives
intranet
Commits
8a264f04
Commit
8a264f04
authored
Dec 10, 2015
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draft d'interface de choix de la langue
parent
7e510f3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
intranet/settings.py
intranet/settings.py
+8
-0
intranet/urls.py
intranet/urls.py
+2
-1
templates/template.html
templates/template.html
+13
-0
No files found.
intranet/settings.py
View file @
8a264f04
...
...
@@ -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'
,
)
...
...
intranet/urls.py
View file @
8a264f04
...
...
@@ -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"
]
...
...
templates/template.html
View file @
8a264f04
{% 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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment