Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vve-baidu-translate-service

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vve-baidu-translate-service

BaiDu Universal translation API access document

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58
increased by107.14%
Maintainers
1
Weekly downloads
 
Created
Source

baidu-translate-service

该库通过封装了百度翻译的API信息,支持浏览器,客户端,nodejs调用百度翻译接口,欢迎大家使用,记得start

parameter

字段名类型是否必填描述备注
qstring请求翻译queryUTF-8编码
tostring翻译目标语言不可设置为auto
appidstringAPPID可在管理控制台查看
keystring秘钥在控制台申请查看
fromstring翻译源语言默认值为auto
ttsinteger是否显示语音合成资源0-显示,1-不显示,默认值为 1
dictinteger是否显示词典资源0-显示,1-不显示 ,默认值为 1
actioninteger判断是否需要使用自定义术语干预API1-是,0-否,默认值为 0

Response

参考官方文档链接

Demo

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

<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

npm install vve-baidu-translate-service
const baiduTranslateService = require("vve-baidu-translate-service").default;

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

Keywords

FAQs

Package last updated on 27 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc