comparison 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
comparison
equal deleted inserted replaced
1:a49aa1b823f6 2:0df46e87537d
20 You should have received a copy of the GNU Affero General Public License 20 You should have received a copy of the GNU Affero General Public License
21 along with Foobar. If not, see <http://www.gnu.org/licenses/>. 21 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
22 """ 22 """
23 from django.http import Http404 23 from django.http import Http404
24 from django.shortcuts import render_to_response 24 from django.shortcuts import render_to_response
25 from django.core.context_processors import csrf
26 from django.utils.translation import ugettext_lazy as _
25 from collections import OrderedDict 27 from collections import OrderedDict
26 import screenshots, social_contract, utils 28 import screenshots, social_contract, utils
27 29
28 CATEGORIES = OrderedDict([("features", "Features"), 30 CATEGORIES = OrderedDict([("features", _("Features")),
29 ("frontends", "Frontends"), 31 ("frontends", _("Frontends")),
30 ("screenshots", "Screenshots & Videos"), 32 ("screenshots", _("Screenshots & Videos")),
31 ("community", "Community"), 33 ("community", _("Community")),
32 ("developers", "Developers corner"), 34 ("developers", _("Developers corner")),
33 ("social_contract", "Social contract")]) 35 ("social_contract", _("Social contract"))])
34 36
35 def overview(request): 37 def overview(request):
36 return render_to_response('sat_website/overview.html') 38 return render_to_response('sat_website/overview.html')
37 39
38 def generic_cat(request, category): 40 def generic_cat(request, category):
39 latest_dl_path, latest_version = utils.get_latest_sat() 41 latest_dl_path, latest_version = utils.get_latest_sat()
40 context = {"categories": CATEGORIES, 42 context = {
43 "available_languages": ['fr', 'en'],
44 "categories": CATEGORIES,
41 "category": category, 45 "category": category,
42 "latest_dl_path": latest_dl_path, 46 "latest_dl_path": latest_dl_path,
43 "latest_version": latest_version, 47 "latest_version": latest_version,
44 } 48 }
45 for k,v in CATEGORIES.iteritems(): 49 context.update(csrf(request))
46 print "category: %s:%s" % (k,v) 50
47 if not category or category == "overview": 51 if not category or category == "overview":
48 return render_to_response('sat_website/overview.html', context) 52 return render_to_response('sat_website/overview.html', context)
49 elif category == "screenshots": 53 elif category == "screenshots":
50 context["screenshots"] = screenshots.screenshots 54 context["screenshots"] = screenshots.screenshots
51 context["screencasts"] = screenshots.screencasts 55 context["screencasts"] = screenshots.screencasts