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 🙏

© 2025 – Pkg Stats / Ryan Hefner

next-translate-excel

v1.1.0

Published

A CLI tool for managing i18n translations with DeepL API

Readme

next-translate-excel

一个用于管理国际化翻译的命令行工具,支持 JSON 与 Excel 之间的相互转换,并集成了 DeepL 翻译功能。

安装

npm install -g next-translate-excel

功能特点

  • 将 JSON 格式的翻译文件导出为 Excel 表格
  • 自动使用 DeepL API 进行中英文翻译
  • 从 Excel 表格导入翻译并生成对应的 JSON 文件
  • 支持嵌套的 JSON 结构
  • 使用 TypeScript 编写,提供完整的类型支持
  • 支持的语言:zh, en, ko, id, th, tw, vi
  • 新功能: 从 Git commit 中提取翻译变化并生成 Excel

使用方式

导出翻译到 Excel

next-translate-execel export -k your-deepl-api-key -s ./zh -o translations.xlsx

选项说明:

  • -k, --api-key: DeepL API Key(必需)
  • -s, --source: 源 JSON 文件目录,默认为 "./zh"
  • -o, --output: 输出的 Excel 文件路径,默认为 "translations.xlsx"

导入

next-translate-execel import -s translations.xlsx -o ./messages

更新翻译

next-translate-excel update -k your-deepl-api-key -s ./messages/zh -e translations.xlsx -o translations_updated.xlsx

收集翻译

next-translate-excel collect -s ./messages -o translations_collected.xlsx

选项说明:

  • -s, --source: 源目录,包含各语言子目录,默认为 "./messages"
  • -o, --output: 输出的 Excel 文件路径,默认为 "translations_collected.xlsx"

从 Git Commit 提取翻译 (新功能)

# 从单个 commit 提取
next-translate-excel extract -p ~/code/my-project -c bcd7281d84dfdaf09f4c62d78f79401729e699f8 -o changes.xlsx

# 从多个 commit 提取
next-translate-excel extract -p ../my-project -c commit1,commit2,commit3 -o multi_changes.xlsx

选项说明:

  • -p, --project: Git 项目路径,默认为当前目录
  • -c, --commits: 逗号分隔的 commit ID 列表(必需)
  • -o, --output: 输出的 Excel 文件路径,默认为 "extracted_translations.xlsx"

此命令会:

  • 检查指定的 Git 仓库和 commit ID 是否有效
  • 提取指定 commit 中 messages/ 文件夹下的 JSON 文件变化
  • 将嵌套的 JSON 结构扁平化(如 errors.deposit.400683
  • 生成包含所有语言列的 Excel 文件:key, zh_CN, en_US, ko_KR, in_ID, th_TH, zh_TW, vi_VN

贡献指南

安装依赖

npm install

构建

npm run build

运行

npm run start

测试

npm run test

本地调试

npm run build
npm link

然后在项目中使用 next-translate-excel 命令:

npm link next-translate-excel
next-translate-excel export -k your-deepl-api-key -s ./zh -o translations.xlsx