diff sat_website/views.py @ 2:0df46e87537d

i18n: marked translatable texts + add change language form on pages footer
author Goffi <goffi@goffi.org>
date Mon, 30 Jul 2012 02:09:38 +0200
parents a49aa1b823f6
children d42dd630476f
line wrap: on
line diff
--- a/sat_website/views.py	Sun Jul 29 01:52:27 2012 +0200
+++ b/sat_website/views.py	Mon Jul 30 02:09:38 2012 +0200
@@ -22,28 +22,32 @@
 """
 from django.http import Http404
 from django.shortcuts import render_to_response
+from django.core.context_processors import csrf
+from django.utils.translation import ugettext_lazy as _
 from collections import OrderedDict
 import screenshots, social_contract, utils
 
-CATEGORIES = OrderedDict([("features", "Features"),
-              ("frontends", "Frontends"),
-              ("screenshots", "Screenshots & Videos"),
-              ("community", "Community"),
-              ("developers", "Developers corner"),
-              ("social_contract", "Social contract")])
+CATEGORIES = OrderedDict([("features", _("Features")),
+              ("frontends", _("Frontends")),
+              ("screenshots", _("Screenshots & Videos")),
+              ("community", _("Community")),
+              ("developers", _("Developers corner")),
+              ("social_contract", _("Social contract"))])
 
 def overview(request):
     return render_to_response('sat_website/overview.html')
 
 def generic_cat(request, category):
     latest_dl_path, latest_version = utils.get_latest_sat()
-    context = {"categories": CATEGORIES,
+    context = {
+               "available_languages": ['fr', 'en'],
+               "categories": CATEGORIES,
                "category": category,
                "latest_dl_path": latest_dl_path,
                "latest_version": latest_version,
               }
-    for k,v in CATEGORIES.iteritems():
-        print "category: %s:%s" % (k,v)
+    context.update(csrf(request))
+
     if not category or category == "overview":
         return render_to_response('sat_website/overview.html', context)
     elif category == "screenshots":