Adnane Belmadiaf has proposed merging lp:~adnane002/loco-directory/fix.570638 
into lp:loco-directory.

Requested reviews:
  loco-directory-dev (loco-directory-dev)
Related bugs:
  #570638 translations not selectable on the website
  https://bugs.launchpad.net/bugs/570638


a language men is now available at the bottom right of the page
-- 
https://code.launchpad.net/~adnane002/loco-directory/fix.570638/+merge/31175
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~adnane002/loco-directory/fix.570638 into lp:loco-directory.
=== modified file 'loco_directory/common/views.py'
--- loco_directory/common/views.py	2010-07-15 07:56:44 +0000
+++ loco_directory/common/views.py	2010-07-28 16:22:45 +0000
@@ -3,6 +3,8 @@
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 from django.contrib.auth import logout
+from django.utils.translation import check_for_language
+from django.conf import settings
 
 def index(request):
     context = {}
@@ -22,3 +24,20 @@
 def site_logout(request):
     logout(request)
     return HttpResponseRedirect('/')
+
+
+def set_language(request):
+    """
+    Change the language for a user
+    """
+    next = request.META.get('HTTP_REFERER', None)
+    if not next:
+        next = '/'
+    response = HttpResponseRedirect(next)
+    lang = request.GET.get('lang', '')
+    print lang
+    if check_for_language(lang):
+        if hasattr(request, 'session'):
+            request.session['django_language'] = lang
+        response.set_cookie(settings.LANGUAGE_COOKIE_NAME,lang)
+    return response

=== modified file 'loco_directory/media/css/newstyle.css'
--- loco_directory/media/css/newstyle.css	2010-06-17 19:11:30 +0000
+++ loco_directory/media/css/newstyle.css	2010-07-28 16:22:45 +0000
@@ -107,3 +107,29 @@
     #main-content .resource:hover {
         border: 1px #eee solid;
         }
+
+    #page-footer .container div.copyright {
+        font-size:0.75em;  
+        line-height:1.5em;
+        }
+
+    #page-footer .container div.loggedin {
+        font-size:0.75em;  
+        line-height:1.5em;
+        float:left;width :45%;
+        margin-bottom:10px;
+        margin-top:5px;
+        }
+
+    #page-footer .container div.lang_switcher {
+        font-size:0.75em;  
+        line-height:1.5em;
+        float:right; 
+        width :55%;
+        margin-bottom:10px;
+        margin-top:5px;
+        }
+
+
+
+

=== modified file 'loco_directory/templates/base.html'
--- loco_directory/templates/base.html	2010-07-15 07:56:44 +0000
+++ loco_directory/templates/base.html	2010-07-28 16:22:45 +0000
@@ -44,10 +44,22 @@
 {% endblock %}
 
 {% block footer %}
-<p>{% if user.is_authenticated %}{% trans "Logged in as" %}:  <a href="http://launchpad.net/~{{ user.username }}">{{ user.username }}</a>{% endif %}</p>
-<p>
+<div style="height: 40px;">
+	<div class="loggedin">{% if user.is_authenticated %}{% trans "Logged in as" %}:  <a href="http://launchpad.net/~{{ user.username }}">{{ user.username }}</a>{% endif %}</div>
+	<div class="lang_switcher">
+		<form name="lang-switcher" style="text-align:right;" action="/language/" method="get">
+		<input name="next" type="hidden" value="{{ request.path }}" />
+		    <select name="lang" onchange="document.forms['lang-switcher'].submit()">
+			{% for lang in LANGUAGES %}
+			    <option value="{{ lang.0 }}"{% ifequal LANGUAGE_CODE lang.0 %} selected="selected"{% endifequal %}>{{ lang.1 }}</option>
+			{% endfor %}
+		    </select>
+		</form>
+	</div>
+</div>
+<div class="copyright">
 &copy; 2008-{% now "Y" %} Canonical Ltd., Ubuntu Community. See <a href="https://launchpad.net/loco-directory";>LoCo Directory Project</a> for details.  Ubuntu is a registered trademark of Canonical Ltd.<br />{% trans "LoCo Directory" %} {{ loco_version }}
-</p>
+</div>
 {% endblock %}
 
 {% block footer_list_1 %}

=== modified file 'loco_directory/urls.py'
--- loco_directory/urls.py	2010-07-15 07:56:44 +0000
+++ loco_directory/urls.py	2010-07-28 16:22:45 +0000
@@ -7,6 +7,7 @@
 
 urlpatterns = patterns('',
     url(r'^$', 'common.views.index', name='home'),
+    url(r'^language/', 'common.views.set_language', name='set_language'),
     url(r'^about/$', 'common.views.about', name='about'),
     url(r'^openid/', include('django_openid_auth.urls')),
     url(r'^admin/(.*)', admin.site.root),

_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to