summaryrefslogtreecommitdiff
path: root/bin/extra/trl
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-11 21:48:56 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-11 21:48:56 +0200
commita857f247d9a71b88a4f0dbcfa95e3679e8456e70 (patch)
tree846ddcd8117be1505a970e3638fc65d0ec954a2e /bin/extra/trl
parent75196520b3d6a0e60db1d03a64aaa0655cc4f202 (diff)
parent6251d6ba1054cd79387f0f88ce25d2f4bc8b78c4 (diff)
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'bin/extra/trl')
-rwxr-xr-xbin/extra/trl33
1 files changed, 4 insertions, 29 deletions
diff --git a/bin/extra/trl b/bin/extra/trl
index 55d65ee..957d0fb 100755
--- a/bin/extra/trl
+++ b/bin/extra/trl
@@ -5,33 +5,7 @@
# returns available languages
languages () {
- cat <<-EOF
- arabic
- dutch
- french
- german
- polish
- english
- portuguese
- spanish
- romanian
- hebrew
- swedish
- italian
- turkish
- japanese
- ukrainian
- korean
- chinese
- czech
- hungarian
- danish
- persian
- greek
- slovak
- hindi
- thai
- EOF
+ printf 'arabic\nchinese\nczech\ndanish\ndutch\nenglish\nfrench\ngerman\ngreek\nhebrew\nhindi\nhungarian\nitalian\njapanese\nkorean\npersian\npolish\nportuguese\nromanian\nslovak\nspanish\nswedish\nthai\nturkish\nukrainian\n'
}
if [ -z "${word:=$1}" ]
@@ -47,11 +21,12 @@ primary="$(languages | fzf --prompt="from:")"
secondary="$(languages | fzf --prompt="to:")"
[ "$secondary" ] || exit 1
-curl -s "https://context.reverso.net/translation/$primary-$secondary/$word" \
+# url="https://www.reverso.net/text-translation#sl=$primary&tl=$secondary&text=$word"
+url="https://context.reverso.net/translation/$primary-$secondary/$word"
+curl -s "$url" \
--compressed \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
- -H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br' |
pup 'a.link_highlighted em text{}' |
sed 's/.*/\L&/' |