
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
@aplus-frontend/translate-utils
Advanced tools
一个翻译工具函数库。支持有道,谷歌,百度。
pnpm i @aplus-frontend/translate-utils
interface GoogleOption {
word: string // 待翻译文本
originLang: string // 源语言
targetLang: string // 目标语言
proxy: string | undefined // 代理地址
}
declare function googleTranslate(option: GoogleOption): Promise<string>
例子
const res = await googleTranslate({
word: '翻译内容',
originLang: 'zh-CN',
targetLang: 'en-US',
proxy: 'socks://127.0.0.1:1080',
})
interface YoudaoConfig {
key?: string // 有道词典appKey
secret?: string // 有道词典appSecret
}
interface YoudaoOption {
word: string // 待翻译文本
originLang: string // 源语言
targetLang: string // 目标语言
option: YoudaoConfig // 有道词典配置
}
declare function youdaoTranslate(option: YoudaoOption): Promise<string>
例子
const res = await youdaoTranslate({
word: '翻译内容',
originLang: 'zh-CN',
targetLang: 'en-US',
option: {
key: '2d8e89a6fd072117',
secret: 'HiX7rGmYRad3ISMLYexRLfpkJi2taMPh',
},
})
interface BaiduConfig {
key?: string
secret?: string
}
interface BaiduOption {
word: string // 待翻译文本
originLang: string // 源语言
targetLang: string // 目标语言
option: BaiduConfig // 有道词典配置
}
declare function baiduTranslate(option: YoudaoOption): Promise<string>
例子
const res = await baiduTranslate({
word: '翻译内容',
originLang: 'zh-CN',
targetLang: 'en-US',
option: {
key: '2d8e89a6fd072117',
secret: 'HiX7rGmYRad3ISMLYexRLfpkJi2taMPh',
},
})
FAQs
The npm package @aplus-frontend/translate-utils receives a total of 2 weekly downloads. As such, @aplus-frontend/translate-utils popularity was classified as not popular.
We found that @aplus-frontend/translate-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

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.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.