From d3d5b69a8422f2030c8a740b4c00dc6513da66d1 Mon Sep 17 00:00:00 2001 From: sanj Date: Mon, 15 Nov 2010 06:53:23 +0530 Subject: [PATCH] added more translations + fix translations for dynamic content --- vurbanism/flyovers/views.py | 17 ++++++++++++++--- vurbanism/static/js/vurbanism.js | 11 ++++++++--- vurbanism/templates/flyovers.html | 29 +++++++++++++++-------------- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/vurbanism/flyovers/views.py b/vurbanism/flyovers/views.py index 9a10e4a..f7886e0 100644 --- a/vurbanism/flyovers/views.py +++ b/vurbanism/flyovers/views.py @@ -1,3 +1,5 @@ +#coding=utf-8 + # Create your views here. from django.shortcuts import render_to_response from django.http import HttpResponse @@ -7,9 +9,18 @@ from django.core.mail import send_mail from models import * QUESTIONS = { - '1problems': 'What problems do flyover and skywalk projects create?', - '2like': 'What do you like about these projects?', - '3stories': 'Do you have any stories about flyovers or skywalks in Mumbai or elsewhere?' + '1problems': { + 'en': u'What problems do flyover and skywalk projects create?', + 'hi': u'हवाई पुल और स्क्य्वाल्क्स योजनाओ से किस प्रकार की मुश्किले होती हैं?' + }, + '2like': { + 'en': u'What do you like about these projects?', + 'hi': u'इन योजनाओ मे आपको क्या पसंद आया?' + }, + '3stories': { + 'en': u'Do you have any stories about flyovers or skywalks in Mumbai or elsewhere?', + 'hi': u'क्या आपके पास मुंबई या कहीं और के हवाई पुल या स्क्य्वाल्क्स से संबंधित अपना कोई अनुभव है? ' + } } def geojson(request): diff --git a/vurbanism/static/js/vurbanism.js b/vurbanism/static/js/vurbanism.js index 0494e34..d8bcdad 100644 --- a/vurbanism/static/js/vurbanism.js +++ b/vurbanism/static/js/vurbanism.js @@ -225,8 +225,11 @@ $(function() { }); }); -function translatePage(lang) { - $('.translatable td, .trans').each(function() { +function translatePage(lang, filter) { + if (filter === undefined) { + var filter = '.translatable td, .trans'; + } + $(filter).each(function() { var t = $(this); var currentData = "lang_" + CURRENT_LANGUAGE; var newData = "lang_" + lang; @@ -248,7 +251,9 @@ $(function() { $(this).addClass('navSelected'); // var html = $('#' + $(this).attr("data-target")).html(); var html = tmpl('tmpl_' + $(this).attr('data-target'), {}); - $('#media').html(html); + $('#media').html(html); + var filter = '#media .trans'; + translatePage(CURRENT_LANGUAGE, filter); }); $('.langButton').click(function() { diff --git a/vurbanism/templates/flyovers.html b/vurbanism/templates/flyovers.html index f17d98f..ea9db2e 100644 --- a/vurbanism/templates/flyovers.html +++ b/vurbanism/templates/flyovers.html @@ -58,20 +58,21 @@