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-json-generater

v1.2.2

Published

CLI to generate i18n JSON files

Downloads

15

Readme

i18n-json-generater


A CLI tool to create i18n JSON files from excel(*.xlsx) file.

if the gif does't work, click demo.gif to view the original gif.

install

npm i -g i18n-json-generater

usage

After installation, type command lang xxx, then follow the prompts. You can also use npx instead.

lang create
lang extract
// or
npx i18n-json-generater create
npx i18n-json-generater extract

There are two kinds of command to use:

  • lang create Create JSON file for multilingual application.
  • lang extract Create XLSX file as translate template file, similar to an inverse operation.

arguments

1. create (generate JSON file from XLSX file)

  • The first prompt is to get the path of excel file. The Table of the excel file is something like below:

    A|B|C|D|E|F --|--|--|--|--|-- 1|key|zh|en|de|more language 2|name|爆爆|Bob|Bubikopf|... 3|contact|86 XXX XXXXXXX|44 XXX XXXXXXX|49 XXX XXXXXXX|... 4|address.country|中国|England|Deutschland|...

    You can also get lang-template.xlsx in this repository to see the document format.

  • The secound prompt is to choose the language type you want to create. Up to now, it supports four kind of type based on frequency of use.

    • zh is for Chinese, and your excel file should include zh column.

    • en is for English, and your excel file should include en column.

    • de is for German, and your excel file should include de column.

    • all is a special type because you can create all language of your table from the excel template file.

  • The finally prompt is a confirm, type Y to continue and after a moment you will get the JSON files in the current directory. The JSON files will be automatic generated. Take the chinese file(zh.json) as an example, its content like below:

    {
      "name": "爆爆",
      "nationality": "中国",
      "contact": "86 XXX XXXXXXX",
      "address": {
        "country": "中国",
        "city": "上海"
      },
      "hobby": {
        "food": {
          "coke": "可乐",
          "cake": "蛋糕"
        },
        "film": {
          "action": "动作片",
          "magic": "魔幻片"
        }
      },
      "habby": {
        "game": "电脑游戏"
      }
    }

    You can try to use the lang-template.xlsx file in the repository to get the result.

    Now only supports generated files in the current directory

    Note: you should always set the key in the first column, that's very necessary and important.

2. extract (generate XLSX file from JSON file)

  • The first prompt is to type the path of JSON file or the Directory which includes JSON files. You can also get lang-template.json in this repository to see the file format. You can parse multiple files or directories at once and separate with semicolons and commas, such as ./lang;./en.json. Note that if it is a directory, only the json file in the current directory is parsed

  • The secound prompt is to input the language abbreviation what translated in your JSON file, such as zh,en,de etc.

    What you type in this step, will be the table header column for your translation.

  • The finally prompt is a confirm, type Y to continue and after a moment you will get the XLSX file in the current directory.

If the key in a JSON file does not exist in other JSON files, the columns corresponding to other JSON files in the .xlsx file will be empty

remark

Always remember the first row in table is very important. It should include key in it. Anothers should be the language abbreviations of what you want to generated, such as en, de, jp, fr etc.

todo

  • It's not support to specify the path of the generated files, I will support it in future.
  • It's more reasonable if the JSON file named zh-CN.json istead of zh.json.

for fun :)