aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-12 02:53:34 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-12 02:53:34 +0100
commitd29d218edd81616cce42ebe0ce5593784bda3ec9 (patch)
tree3d7e7ac70273d2a9425bea9986096f5fc51da8ce
parente7b39c9f3cd1498cb04a18ecfb58f5d7c68eb2fb (diff)
Fix multiline translation (only first line was selected)HEADmaster
-rwxr-xr-xgoogle-translate.sh2
1 files changed, 1 insertions, 1 deletions
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"; "")'