# vve-baidu-translate-service

> BaiDu Universal translation API access document

Latest version **3.1.1** (published 2025-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install vve-baidu-translate-service
pnpm add vve-baidu-translate-service
yarn add vve-baidu-translate-service
bun add vve-baidu-translate-service
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2025-02-10 |
| First published | 2024-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 3 |
| Unpacked size | 28.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | nianqin |
| Maintainers | nianqin |
| Keywords | baidu-translate, baidu-translate-service, translate-service |

## Links

- npm: https://www.npmjs.com/package/vve-baidu-translate-service
- Repository: https://github.com/vue-viewer-editor/vve-baidu-translate-service
- Homepage: https://github.com/vue-viewer-editor/vve-baidu-translate-service#readme
- Issues: https://github.com/vue-viewer-editor/vve-baidu-translate-service/issues
- npm.io page: https://npm.io/package/vve-baidu-translate-service

## Dependencies (3)

- [qs](https://npm.io/package/qs.md) ^6.14.0
- [md5](https://npm.io/package/md5.md) ^2.3.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.11

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.1.1 (latest) — 2025-02-10
- 3.0.2 — 2024-03-27
- 3.0.1 — 2024-03-27
- 2.3.1 — 2024-02-21

## README

# baidu-translate-service

该库通过封装了百度翻译的API信息，支持浏览器，客户端，nodejs调用百度翻译接口，欢迎大家使用，记得[start](https://github.com/vue-viewer-editor/vve-baidu-translate-service.git)

## parameter

字段名|	类型|	是否必填|	描述|	备注
------|------|------|------|------
q	|string|	是|	请求翻译query	|UTF-8编码
to	|string|	是|	翻译目标语言|	不可设置为auto
appid	|string|	是|	APPID|	可在管理控制台查看
key|	string|	是|	秘钥|	在控制台申请查看
from	|string|	否|	翻译源语言|	默认值为auto
tts|	integer	|否|	是否显示语音合成资源|	0-显示，1-不显示，默认值为 1
dict|	integer|	否|	是否显示词典资源|	0-显示，1-不显示 ，默认值为 1
action|	integer|	否	|判断是否需要使用自定义术语干预API|	1-是，0-否，默认值为 0

## Response

[参考官方文档链接](https://fanyi-api.baidu.com/product/113)


## Demo

>Browsers (接口请求存在跨域问题)

```html
<script src="https://unpkg.com/vve-baidu-translate-service/lib/baiduTranslateService.js"></script>

<script>
  baiduTranslateService({
    appid: "",
    key: "",
    to: "en",
    q: "今天星期几？",
  }).then((result) => {
    console.log(result);
  });
</script>

```

>Nodejs

```bash
npm install vve-baidu-translate-service
```

```javascript
const baiduTranslateService = require("vve-baidu-translate-service").default;

baiduTranslateService({
  appid: "",
  key: "",
  to: "en",
  q: "今天星期几？",
}).then((result) => {
  console.log(result);
});

```

---
_Source: https://npm.io/package/vve-baidu-translate-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
