A local server can be used as a local translate server, using https://translate.google.cn/translate_a/single as backend.
Clone this repository to some directory, then
npm install --save-dev
node index.js [port]
The default port is 3001, if there's no port argument provided via command line.
-
path:
/translate
-
method:
POST
-
request:
- body:
{text: '...'}
, - desc: text的长度不可超过4000字符
- body:
-
response:
- on success:
{error: 0, result: '...'}
- on error:
{error: 非零整数, message: '....'}
- on success:
Inspired by https://github.com/yixianle/translate-api
and token is generated by https://github.com/jerry-i/google-translate-token-plus
.