How to use google translator from Julia level?

You left out HTTP.escapeuri(...). That said, it doesn’t seem to work for longer texts, as the returned string is split up. You can just join them, though:

function gtranslate(text, targetlang, sourcelang = "auto")
    url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" * sourcelang * "&tl=" * targetlang * "&dt=t&q=" * HTTP.escapeuri(text)
    result = JSON.parse(String(HTTP.request("GET", url).body))
    join([s[1] for s in result[1]], "")
end
3 Likes