swift - Translate more than one string in iOS with Google Translate API -


i trying translate strings google translate api, can't translate more 1 string @ time latest vesrsion of api. using alamofire make request when try create parameter dictionary same key in docs, fails of course. parameters should in format.

{ 'q': 'hello world', 'q': 'my name jeff', 'target': 'de' }

anybody has ideas on how send request same key on parameters?

the way made work altering httpbody of request.

    var requestbody = "{"     (_, value) in alltext {         requestbody.append("\'q\':\'\(value)\',")     }     requestbody.append("\'source\':\'\(language.english.rawvalue)\',")     requestbody.append("\'target\':\'\(language.rawvalue)\'")     requestbody.append("}")      var request = urlrequest(url: url!)     request.httpmethod = httpmethod.post.rawvalue     request.setvalue("application/json; charset=utf-8", forhttpheaderfield: "content-type")     request.httpbody = jsondata 

and performing request alamofire worked me.

i don't know why can't provide solution downvotes question, whatever, , hope may run same task.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -