From cb1bec6d0b8ab2b62d1576b44f4f75653f964ca9 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 19 Jul 2022 02:46:32 +0200 Subject: [PATCH] translate: replace newlines with \n --- .config/zsh/functions/translate | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/zsh/functions/translate b/.config/zsh/functions/translate index 848ea5f..7786575 100755 --- a/.config/zsh/functions/translate +++ b/.config/zsh/functions/translate @@ -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"}' \