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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lang-to-json

v0.0.7

Published

excel to json, multilingual

Downloads

4

Readme

安装lang-to-json:(全局安装!)

  • npm install lang-to-json -g

参数:

|参数名|必选|类型|说明| |:---- |:---|:----- |----- | |-x |是 |string | excel路径 | |-o |否 |string | 输出路径 |

使用示例

  // 只使用 -x 参数,指明excel文件路径名。可相对路径亦可绝对。
  D:\raojianbing\anpm\lang-to-json>lang-to-json -x test/excel.xlsx
  ----
  // 使用 -x 参数,指明excel文件路径名。-o 指明输出的json语言包路径。
  D:\raojianbing\anpm\lang-to-json>lang-to-json -x test/excel.xlsx -o ../lang
  

excel示例,filename字段用来生成文件名(为了兼容,lang字段也可以生成文件名,优先filename。生成.json格式)

生成的en_lang.json文件如下

{
    "filename": "en_lang",
    "lang": "en",
    "title_image": "body_ \"dsa\" en_m.png",
    "apply_btn": "Apply d'd'now",
    "apply_condition_t": "recruitment conditions",
    "apply_condition_c": [
        {
            "c": "1,condition condition condition condition, condition condition condition condition. Condition condition condition, condition condition condition."
        },
        {
            "c": "2,condition condition condition condition, condition condition condition condition. Condition condition condition, condition condition condition."
        }
    ],
    "test": [
        "test",
        "test2"
    ]
}

基于 https://github.com/stevetarver/excel-as-json

如果想通过 apply_reward_c[0], apply_reward_c[1] 这种方式添加基本类型,需要做如下修改。

因为excel-as-json的作者不赞同数组的基础相是基本类型。 找到文件,一般node安装没有改过目录则 C:\Users\DW\AppData\Roaming\npm\node_modules\lang-to-json\node_modules\excel-as-json\lib\excel-as-json.js 文件

   if (keyIsList && (index != null)) {
        console.error("WARNING: Unexpected key path terminal containing an indexed list for <" + keyName + ">");
        console.error("WARNING: Indexed arrays indicate a list of objects and should not be the last element in a key path");
        console.error("WARNING: The last element of a key path should be a key name or flat array. E.g. alias, aliases[]");
        console.error("TIPS: 以下内容为私自扩展,支持arr[0],arr[1]类似写法,追加基本类型数据")
        if (index == 0) {
              obj[keyName] = []
        }
        return obj[keyName][index] = convertValue(value)
    console.error("TIPS: 以上内容为私自扩展,支持arr[0],arr[1]类似写法,追加基本类型数据")
   }