离线中英文翻译“单词”，支持浏览器和 nodejs 环境，感谢 [vscode_english_chinese_dictionary](https://github.com/program-in-chinese/vscode_english_chinese_dictionary) 提供的数据。

> [!NOTE]
> 不翻译长句，只翻译单词，只支持 ESM，因为用了动态导入 [`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import)

# 安装

```bash
npm install zh-translator
```

# 使用

```js
import { translate } from 'zh-translator'

await translate('do')
/*
[{
  word: 'do',
  translation: 'v. 做, 进行, 完成',
  inflection: [
    { type: '现在分词', value: 'doing' },
    { type: '过去式', value: 'did' },
    { type: '第三人称单数', value: 'does' },
    { type: '过去分词', value: 'done' },
  ],
}]
*/

await translate('HelloWorld')
/*
[
  { word: 'hello world', translation: '你好世界', inflection: [] },
  {
    word: 'hello',
    translation: 'interj. 喂, 嘿',
    inflection: [{ type: '复数', value: 'hellos' }],
  },
  {
    word: 'world',
    translation:
      'n. 世界, 地球, 宇宙, 万物, 世人, 人间, 领域, 世事, 世故, 社会生活, 大量\\n[法] 世界, 地球, 世人',
    inflection: [{ type: '复数', value: 'worlds' }],
  },
]
*/
```
