soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.94k stars 391 forks source link

Delay [feature request] #409

Open p1839251 opened 3 years ago

p1839251 commented 3 years ago

Hello, People report this 'empty string' issue from time to time, (even though it's discouraged in the FAQ) Anyway, I found out that I can translate more text if I insert some delay between the requests. So, instead of your example: trans :fr file://input.txt

You can try this (and you don't even need a VPN)

while IFS= read -r line; do
   trans -b :fr "$line"
   sleep 6
done < input.txt

Could you please implement some kind of similar technique?

p1839251 commented 3 years ago

Hint: an option -delay (unfortunately -d is already taken) that would expect seconds, sounds great