0.5.11 • Published 7 months ago

cc-translate v0.5.11

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

cc-translate

一个基于Chat GPT的翻译库 🚀

特征

  • 支持通过一种源语言翻译出多国语言
  • 默认使用gpt-4o模型进行翻译,你也可以设置.gpt-4o性价比更高

安装

# 使用 npm
npm install cc-translate -D

# 或者使用 yarn
yarn add cc-translate -D

快速开始

// translate.mjs
import {CwalletTranslate} from 'cc-translate';

// 获取当前文件的完整路径
const __dirname = import.meta.dirname;

// 创建一个translate实例
const client = new CwalletTranslate({
  key: "your api key",
  sourceLanguage: 'en',
  // 缓存文件路径
  cacheFileRootPath: path.resolve(__dirname, './cache'),
  // 翻译源文件路径
  fileRootPath: path.resolve(__dirname, './langs'),
  // 调整翻译语境,告诉gpt我们的翻译要求。提高翻译准确性!
  fineTune: ['我们是一个区块链钱包', '请使用行业专业术语并更切合生活的翻译',....],
  // 需要翻译的语言列表
  languages: [
    'zh-CN',
    'zh-TW',
    'ja',
    'ar',
    ...
  ],
  // 输出文件路径
  outputRootPath: path.resolve(__dirname, './langs'),
});
0.5.10

7 months ago

0.5.11

7 months ago

0.5.8

8 months ago

0.5.7

8 months ago

0.5.9

8 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.5.6

8 months ago

0.5.5

8 months ago

0.4.5

8 months ago

0.4.4

8 months ago

0.4.6

8 months ago

0.5.0

8 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.4.3

9 months ago

0.4.2

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago