File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
backend/MultiLangProject/MultiLangApp Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,15 @@ def get_summary(request):
3030 return JsonResponse (data )
3131
3232def translate (request ):
33- article = request .GET .get ('article' , None )
34-
35- print ('article:' , article )
33+ if request .method == 'PUT' :
34+ article = request .data .get ('article' , None )
35+ print ('article:' , article )
36+ lang = request .data .get ('language' , None )
3637
3738 auth_key = "da19e392-2688-f41f-38d5-5389e9ad7b56:fx" # Replace with your key
3839 translator = deepl .Translator (auth_key )
3940
40- result = translator .translate_text (article , target_lang = "FR" )
41+ result = translator .translate_text (article , target_lang = lang )
4142 print (result .text ) # "Bonjour, le monde !"
4243 res = {
4344 'translation' : result .text ,
You can’t perform that action at this time.
0 commit comments