npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

seasun-translate

v1.0.5

Published

多语言翻译工具

Readme

Seasun Translate

多语言翻译工具(Seasun Translate, SST)是一个基于百度翻译 API 的命令行工具,用于自动将中文 JSON 文件翻译成多种语言。专为多语言项目设计。

特性

  • 🚀 支持一键翻译中文 JSON 文件到多种语言
  • 🌍 默认支持繁体中文、英文、日文、韩文
  • ⚙️ 可配置的翻译目标语言和文件名
  • 🔑 支持百度翻译 API 密钥配置
  • 💾 支持全局配置文件
  • 🎯 保持 JSON 结构不变,只翻译值

演示

使用演示

安装

npm install -g seasun-translate

快速开始

  1. 初始化配置文件:
sst --init
  1. 编辑配置文件(sst.config.js),填入你的百度翻译 API 密钥:
module.exports = {
    baiduTranslate: {
        appId: '你的百度翻译APP_ID',
        secretKey: '你的百度翻译密钥'
    },
    // ... 其他配置
};
  1. 准备好你的中文 JSON 文件(默认名称:zh-CN.json

  2. 运行翻译命令:

sst

配置文件说明

配置文件支持以下选项:

module.exports = {
    // 百度翻译 API 配置
    baiduTranslate: {
        appId: '你的百度翻译APP_ID',
        secretKey: '你的百度翻译密钥',
        apiUrl: 'https://fanyi-api.baidu.com/api/trans/vip/translate'
    },

    // 支持的目标语言配置
    targetLanguages: {
        'zh-TW': {
            name: '繁体中文',
            code: 'cht',
            fileName: 'zh-TW.json'
        },
        'en': {
            name: '英文',
            code: 'en',
            fileName: 'en-US.json'
        },
        'ja': {
            name: '日文',
            code: 'jp',
            fileName: 'ja-JP.json'
        },
        'ko': {
            name: '韩文',
            code: 'kor',
            fileName: 'ko-KR.json'
        }
    },

    // 源语言文件配置
    sourceLanguage: {
        fileName: 'zh-CN.json',
        code: 'zh'
    }
};

命令行选项

  • --init: 在当前目录初始化配置文件
  • --config <path>: 指定配置文件路径

配置文件查找顺序

  1. 命令行参数指定的路径(如果使用了 --config 选项)
  2. 当前目录下的 sst.config.js
  3. 用户主目录下的 .sst.config.js

注意事项

  1. 请确保你的百度翻译 API 密钥有足够的额度
  2. 建议将配置文件添加到 .gitignore
  3. 翻译请求会自动加入 100ms 的延迟,以避免触发 API 限制

常见问题

Q: 如何修改目标语言? A: 在配置文件的 targetLanguages 中添加或修改目标语言配置。

Q: 如何修改源文件名? A: 在配置文件的 sourceLanguage.fileName 中修改。

贡献指南

欢迎提交 Issue 和 Pull Request。

许可证

MIT License