From d29d218edd81616cce42ebe0ce5593784bda3ec9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 12 Feb 2022 02:53:34 +0100 Subject: Fix multiline translation (only first line was selected) --- google-translate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-translate.sh b/google-translate.sh index f76c27a..e64b96e 100755 --- a/google-translate.sh +++ b/google-translate.sh @@ -4,4 +4,4 @@ text=$(cat) from_lang="auto" to_lang="en" user_agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -curl -gsLf --data-urlencode "q=$text" "https://translate.googleapis.com/translate_a/single?client=gtx&sl=$from_lang&tl=$to_lang&dt=t" | jq -r ".[0][0][0]" +curl -gsLf --data-urlencode "q=$text" "https://translate.googleapis.com/translate_a/single?client=gtx&sl=$from_lang&tl=$to_lang&dt=t" | jq -r '.[0][][0] | sub("\n"; "")' -- cgit v1.2.3