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

Mac OS - goldendict program: Query error: The program has returned exit code 255. #352

Open PhungXuanAnh opened 4 years ago

PhungXuanAnh commented 4 years ago

On Mac OS, when using this program on terminal it work well, but when add this program to goldendict, it show above error

Anyone know about this issue?

JiagengDing commented 3 years ago

I also have this problem. Have you fixed it?

BenzLeung commented 3 years ago

same

IFphoenix commented 2 years ago

I have the same problem, who can help me ORZ!!

jinzi97 commented 2 years ago

I just solved this problem, and it seems work well with me. I found my answer from this thread: https://apple.stackexchange.com/questions/270540/translate-shell-script-not-working-within-automator

I'm not familiar with programming, so I just wrote down the solution.

I used macports to install translate-shell and gawk, and the script file is at the path of /opt/local/bin. I used the code of which gawk to find them.

Then I changed the file of trans by vim as the thread told.

change: gawk -f <(echo -E "$TRANS_PROGRAM") - "$@"
###### this is the last line of the trans script. To: /opt/local/bin/gawk -f <(echo -E "$TRANS_PROGRAM") - "$@"
###### "/opt/local/bin" is just the case for me.

Finally, I used this code in the settings of Goldendict

/opt/local/bin/trans %GDWORD%

P.S. There is no problem to add any options you want after trans.

VirtualBox_MacOS 12 4_08_08_2022_00_27_33 VirtualBox_MacOS 12 4_08_08_2022_00_28_11