This package has been deprecated

Author message:

Package is renamed to @lzy1960/google-translate, please install the new package

@lzy1960storm/google-translate

0.1.0 • Public • Published

google-translate OSCS Status

感谢开源社区 OSCS 的关注!

项目说明

  • TDD 开发流程
  • 使用 ts 编写
  • 集成 vitest 测试

使用方式

  1. 安装依赖包

    npm i @lzy1960storm/google-translate
    // OR
    yarn add @lzy1960storm/google-translate
    // OR
    pnpm i @lzy1960storm/google-translate
  2. 调用

    // default options
    const options = {
     from: 'auto',
     to: 'en',
     tld: 'cn'
    }
    const res1 = await translate('你好', options)
    console.log(res1) // { "from": "zh-CN", "pronunciation": "Nǐ hǎo", "text": "Hello" }
  3. 入参说明

    translate接收两个参数:text 和 options

    options 默认为:

    {
     from: 'auto', // 源语言
     to: 'en', // 目标语言
     tld: 'cn', // 服务地址
     isMobile: false // 是否是移动端(移动端和pc端的返回值不一样)
    }
  4. 返回结果说明

    {
     from: "zh-CN", // 源语言
     pronunciation: null, // 读音
     text: "Hello" // 目标语言结果
    }

/@lzy1960storm/google-translate/

    Package Sidebar

    Install

    npm i @lzy1960storm/google-translate

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    108 kB

    Total Files

    18

    Last publish

    Collaborators

    • lzy1960