levmyshkin/google-translate

Node.js 服务用于 Google 翻译

安装: 138

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

语言:JavaScript

类型:drupal-library

1.0.2 2023-11-05 13:52 UTC

This package is auto-updated.

Last update: 2024-09-05 15:40:26 UTC


README

这是一个 Drupal 库,用于从 Node.js 服务获取翻译。它依赖于 iamtraction/google-translate npm 包: https://npmjs.net.cn/package/@iamtraction/google-translate https://github.com/iamtraction/google-translate

安装和运行 Node.js 服务

运行以下命令

npm install
npm start

用法

查看 Translator.postman_collection.json 使用 POST 请求: https://:8000

Langcodes 必须是 ISO-639 代码: https://cloud.google.com/translate/docs/languages

使用 x-www-form-urlencoded 数据:translateText: Hello translateFrom: en translateTo: ru

在后台运行 node.js 服务

您可以在后台运行翻译 node.js 服务,甚至可以在系统启动时运行

npm install pm2@latest -g
yarn global add pm2
pm2 start index.js

有关 PM2 的更多信息: https://pm2.node.org.cn/

将应用程序列表保存以在重启时恢复。

启动所有所需的应用程序后,保存应用程序列表,以便在重启后重新启动

pm2 save