0.1.0 • Published 2 years ago

@lzy1960storm/google-translate v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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" // 目标语言结果
    }
0.1.0

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago