diff options
-rw-r--r-- | example_project/settings.py | 5 | ||||
-rw-r--r-- | ishtar_common/static/media/style.css | 17 | ||||
-rw-r--r-- | ishtar_common/templates/base.html | 36 | ||||
-rw-r--r-- | ishtar_common/urls.py | 2 |
4 files changed, 39 insertions, 21 deletions
diff --git a/example_project/settings.py b/example_project/settings.py index 40aa25066..d45770277 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -55,8 +55,8 @@ USE_I18N = True # calendars according to the current locale USE_L10N = True LANGUAGES = ( - ('fr', _('Français')), - ('en', _('Anglais')), + ('fr', u'Français'), + ('en', u'English'), ) DEFAULT_LANGUAGE = 1 @@ -82,6 +82,7 @@ MIDDLEWARE_CLASSES = [ 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.locale.LocaleMiddleware', ] TEMPLATE_CONTEXT_PROCESSORS = ( diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index d9bcd73e7..a219160f2 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -133,16 +133,18 @@ div.nav-button{ div#header{ width:100%; - text-align:center; + text-align:left; font-size: 0.9em; background-color: #EEE; border-bottom:1px solid #CCC; margin-bottom:10px; + line-height:30px; + padding:0 20px; } div#logo{ width:200px; - top:30px; + top:40px; left:30px; padding-top:90px; position:absolute; @@ -151,6 +153,17 @@ div#logo{ background-repeat:no-repeat; } +div#language_form_div{ + position:absolute; + right:0; + top:0; + padding:2px 20px; +} + +div#language_form_div label{ + display:inline; +} + div#context_menu{ height:110px; margin-left:200px; diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 0d0df59e5..60821dee6 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -22,23 +22,27 @@ <body> <div id="header"> {% block header %} - {% if user.is_authenticated %} - {% trans "Logged in" %}: {{ user.username }} - (<a href="{% url auth_logout %}">{% trans "Log out" %}</a> | - <a href="{% url auth_password_change %}">{% trans "Change password" %}</a>) - {% else %} - <strong><a href="{% url auth_login %}">{% trans "Log in" %}</a></strong> - {% endif %} + {% if user.is_authenticated %} + {% trans "Logged in" %}: {{ user.username }} + (<a href="{% url auth_logout %}">{% trans "Log out" %}</a> | + <a href="{% url auth_password_change %}">{% trans "Change password" %}</a>) + {% else %} + <strong><a href="{% url auth_login %}">{% trans "Log in" %}</a></strong> + {% endif %} + {% if LANGUAGES|length > 1 %} + <div id="language_form_div"> + <form action="/i18n/setlang/" method="post" id='language_form'> + {% csrf_token %} + <label for='language_selector'>{% trans "Lang" %}{% trans ":"%} </label> + <select name="language" id='language_selector'> + <option value="">-------</option> + {% for lang in LANGUAGES %} + <option value="{{ lang.0 }}"{% ifequal LANGUAGE_CODE lang.0 %} selected='selected'{% endifequal %}>{{ lang.1 }}</option> + {% endfor %} + </select> + </form> + </div>{% endif %} {% endblock %} - {% comment %} - <form action="/i18n/setlang/" method="post" id='language_form'> - {% csrf_token %} - <select name="language" id='language_selector'> - {% for lang in LANGUAGES %} - <option value="{{ lang.0 }}">{{ lang.1 }}</option> - {% endfor %} - </select> - </form>{% endcomment %} </div> <div class="nav-button ui-state-default ui-corner-all" id="to_bottom_arrow"> <span class="ui-icon ui-icon-circle-arrow-s"></span> diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 3a69ca002..35354409e 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as |