Fixed #690: Language change UI.
authorŁukasz Rekucki <lrekucki@gmail.com>
Fri, 18 Jun 2010 10:40:30 +0000 (12:40 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Fri, 18 Jun 2010 10:40:30 +0000 (12:40 +0200)
wolnelektury/settings.py
wolnelektury/static/css/master.css
wolnelektury/templates/base.html

index 2ece0b1..8a82221 100644 (file)
@@ -33,7 +33,7 @@ LANGUAGE_CODE = 'pl'
 
 gettext = lambda s: s
 
-LANGUAGES = (
+LANGUAGES = tuple(sorted([
     ('pl', gettext('Polish')),
     ('de', gettext('German')),
     ('en', gettext('English')),
@@ -42,7 +42,7 @@ LANGUAGES = (
     ('ru', gettext('Russian')),
     ('es', gettext('Spanish')),
     ('uk', gettext('Ukrainian')),
-)
+], key=lambda x: x[0]))
 
 
 SITE_ID = 1
index 669aeb1..645466c 100644 (file)
@@ -88,6 +88,36 @@ em {
     color: #777;
 }
 
+.lang-menu {
+       margin-right: 0.7em;
+       line-height: 24px;
+} 
+
+.lang-menu button {
+       color: blue;
+       border: none;
+       border-right: 1px solid gray;
+       -moz-border-radius: 2px;
+       background: inherit;    
+       cursor: pointer;
+       padding: 0.2em 0.5em;   
+       font-size: 10px;
+}
+
+.lang-menu button:hover {
+       color: blue;
+       text-decoration: underline;     
+}
+
+.lang-menu button.active {
+       color: black;
+       text-decoration: none;
+}
+
+.lang-menu button.last {
+       border-right: none;
+}
+
 /* ======================== */
 /* = Footer with sponsors = */
 /* ======================== */
index ca41767..da5ab63 100644 (file)
@@ -1,14 +1,13 @@
-{% load i18n %}
-{% load chunks compressed catalogue_tags sponsor_tags %}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
+       {% load i18n chunks compressed catalogue_tags sponsor_tags %}
     <head>
         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
         <title>{% block title %}WolneLektury.pl{% endblock %}</title>
         <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/x-icon" />
         {% compressed_css "all" %}
-        <script type="text/javascript">var LANGUAGE_CODE = "{{ LANGUAGE_CODE}}";</script>
+        <script type="text/javascript">var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";</script>
         {% compressed_js "jquery" %}
         {% compressed_js "all" %}
         {% block extrahead %}
                 <a href="http://nasza-klasa.pl/profile/30441509"><img src="{{ STATIC_URL }}img/social/naszaklasa.png" alt="WolneLektury @ Nasza-Klasa" /></a>
             </div>
                        <div class="lang-menu" style="float:right;">
-                               <form action="/i18n/setlang/" method="post">
-                                       {% trans "Choose your interface language: " %} <select name="language">
-                                               {% for lang in LANGUAGES %}
-                                               <option value="{{ lang.0 }}"{% ifequal lang.0 LANGUAGE_CODE %} selected="selected"{% endifequal %}>{{ lang.1 }}</option>
-                                               {% endfor %}
-                                       </select>
-                                       <input type="submit" value="{% trans "Choose language" %}">
+                               <form action="{% url django.views.i18n.set_language %}" method="POST">
+                                       {% spaceless %}
+                                       {% for lang in LANGUAGES %}                                          
+                                           <button type="submit" name="language" 
+                                                       class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %} {% if forloop.last %}last{% endif %}" 
+                                                       value="{{ lang.0 }}">{{ lang.0|upper }}</button>
+                                       {% endfor %}    
+                                       {% endspaceless %}                              
                                </form>
                        </div>
             <div class="clearboth"></div>