22-08-2024

This commit is contained in:
2024-08-22 08:44:15 +02:00
parent 4675acdd0d
commit aaf3776e62
20 changed files with 782 additions and 4 deletions

17
api_deepl.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
[ ! -f "$HOME/.env" ] || export $(grep -v '^#' "$HOME/.env" | xargs)
# DE/FR/ES/EN-GB/EN-US
translate() {
deepl=$(curl -s -X POST 'https://api-free.deepl.com/v2/translate' \
--header "Authorization: DeepL-Auth-Key $DEEPL_KEY" \
--data-urlencode "text=$2" \
--data-urlencode "target_lang=$1"
)
echo "$deepl" | jq -r .'translations[].text'
}
translate "DE" "il fait beau !"