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

i18n-xlsx-tool

v1.1.10

Published

i18n多语言配置与xlsx文件转换工具

Readme

i18n

使用方法

# 安装依赖
npm install i18n-xlsx-tool

package.json 配置指令

{
  "type": "module",
  "scripts": {
    "i18n": "i18n-xlsx-tool"
  },
}

生成配置文件 i18n.config.js

npm run i18n init
npm run i18n i

收集词条

npm run i18n collect
npm run i18n c

根据i18n配置文件替换词条

npm run i18n replace
npm run i18n r

生成 xlsx

npm run i18n generate
npm run i18n g

生成 xlsx (只生成增量词条文件)

读取本地的i18n词条数据,对比历史生成的xlsx文件,生成增量的词条表格文件

需要配置:historyFileName 字段。

npm run i18n generate-increase
npm run i18n gi

应用之前生成的 xlsx (覆盖)

npm run i18n apply
npm run i18n a

应用 xlsx (非覆盖)

只更新应用文件中的词条数据

npm run i18n append
npm run i18n ap

配置文件 i18n.config.js 说明

{
  // 收集词条相关配置
  collect: {
    // mode: 'dev' | 'production' , dev可以输出ast语法树
    mode: 'dev',
    // 收集模板中的属性
    attrHotToken: [],
    // 收集js中文词条
    hotToken: [],
    // 是否需要将此次收集的要翻译的词条生成xlsx文件
    isCreateExcel: true,
    // 要收集的模块
    entry: {
      // 模块名简写 需要保证多语言文件和模块名保持一致
      utilManage1: './src/views/model/utilManage',
      // 模块名
      utilManage: {
        // 入口文件路径
        path: './src/views/model/utilManage',
        // 多语言文件路径
        i18nSource: './src/lang/en.js',
        // 多语言js文件前缀
        prefix: 'prefix_',
        // 多语言代码code前缀
        prefixCode: ''
      }
    },
    //输出路径
    output: './i18n-directory',
  },
  
  // i18n配置文件目录
  i18nDir: './test/i18n',

  // xlsx文件输出目录
  xlsxDir: './i18n-xlsx',

  // 生成的XLSX文件名(仅在single模式下使用)
  xlsxFileName: 'i18n_translations.xlsx',

  // 历史生成的XLSX文件,请放在xlsxDir配置的目录下
  historyFileName: 'i18n_translations_history.xlsx',

  // 导出模式: 'single' 表示导出到一个XLSX文件,'multiple' 表示导出到多个XLSX文件
  exportMode: 'single',
  // 是否为单一文件模式,如果为true,则i18nDir直接指向文件而不是目录
  isFile: false,

  // 要生成到xlsx文件中的语言及导入时应用的语言
  languages: ['en', 'zh-CN', 'no', 'nl-NL', 'sv-SE', 'th-TH'],
  searchLanguage: 'en',

  // 模块文件匹配模式(可选)
  modulePattern: '**/*.js',

  // 路径别名配置
  alias: {
    '@': './src',
  },
}