Linux操作使用

Linux 命令行使用google翻译

安装translate-shell

sudo apt install translate-shell

写个脚本

cat /opt/applications/bin/google-translate
#!/bin/bash
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ALL_PROXY=http://127.0.0.1:8118

if [ $# -ne 2 ]; then
echo "$0 <language(such as zh-CN, En)> <word>"
exit 255
fi

trans -e google -s auto -t $1 -show-original y -show-original-phonetics n -show-translation y -no-ansi -show-translation-phonetics n -show-prompt-message n -show-languages y -show-original-dictionary n -show-dictionary n -show-alternatives n "$2"

示例:

$ google-translate zh-CN hello
hello

你好

[ English -> 简体中文 ]

GoldenDict添加命令:

打开GoldenDict,【编辑】-【词典】-【词典来源】-【程序】,点击【添加】,勾上【已启用】,填写【类型】和【名称】,【类型】选择纯文本,在【命令行】中输入

/opt/applications/bin/google-translate zh-CN "%GDWORD%"

注意:上面脚本地址要改成你的脚本路径

The End