def mymethod(request):
return_obj = {}
if request.method == 'POST':
info = request.POST
try:
ts_vals, coordinates, name = somefunction(params)
return_obj["values"] = ts_vals
return_obj["msg"] = candy.translated(request, "all_msg") # all_msg is from the excel
return_obj["name"] = name
return_obj["success"] = "success"
except Exception as e:
return_obj["error"] = candy.translated(request, "all_Error")
return JsonResponse(return_obj)
I tried the above process. The returned JSON is parsed in my javascript code and sent back to the interface from javascript code. How do we handle this situation with Candy Translation?
There are 2 ways of doing what you need with CandyTranslate. First Option is using *candy.path for your callable function and then candyLink to call correct language version of the function Second Option is using the {{lang}} variable in template and candy.translated(lang, ...)
------ OPTION 1:
views.py:
urls.py:
your template:
------ OPTION 2:
views.py:
urls.py:
your template: