aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"; "")'