Last active
February 27, 2024 14:08
-
-
Save ychaouche/2ccc158e5fc1f3c9a41518cc585bf200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 10:32:01 ~ -1- $ net.translate "j'ai pas envie de me prendre la tête avec unicode" | |
# I don't want to bother with unicode. | |
# 10:32:23 ~ -1- $ | |
while (( $# )) | |
do | |
case "$1" in | |
-f|--from) | |
from="$2" | |
shift 2 | |
;; | |
-t|--to) | |
to="$2" | |
shift 2 | |
;; | |
*) | |
translate="$1" | |
shift | |
;; | |
esac | |
done | |
url="http://translate.googleapis.com/translate_a/single?client=gtx&sl=$from&tl=$to&dt=t&q=$translate" | |
curl -s "$url" --data-urlencode "q=$translate" | jq -r ".[0][0][0]" -M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment