translate: replace newlines with \n

This commit is contained in:
tastytea 2022-07-19 02:46:32 +02:00
parent 909bb56b4c
commit cb1bec6d0b
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -25,6 +25,7 @@ local to="de"
local text="${@}"
[[ ! -v 1 ]] && text=$(cat -)
text=${text//$'\n'/'\n'}
curl --silent -X POST \
--header 'Content-Type: application/json' \
--data '{"q": "'${text}'", "source": "'${from}'", "target": "'${to}'", "format": "text"}' \