The GoogleTrans.jl
package seems to be broken?
FWIW, the solution posted here does work:
using HTTP, JSON, DataFrames
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
messages = ["Hello Julia." "Thank you for everything"; "You are welcome!" "Bye now"]
df = DataFrame(messages, :auto)
Row │ x1 x2
─────┼────────────────────────────────────────────
1 │ Hello Julia. Thank you for everything
2 │ You are welcome! Bye now
gtranslate.(df,"fr")
Row │ x1 x2
─────┼────────────────────────────────────────────
1 │ Bonjour Julia. Merci pour tout
2 │ Je vous en prie! Et maintenant, au revoir
gtranslate.(df,"iw")
Row │ x1 x2
─────┼───────────────────────────
1 │ שלום ג'וליה. תודה על הכל
2 │ בבקשה! להתראות