cj-lang-build

1.1.1 • Public • Published

Install

  npm i cj-lang-build

Usage

excel 转json

  langBuild = require("cj-lang-build");
  langBuild.xlsToJson({
    input: "sample.xls",  // input xls
    output: "output.json", // output json
    sheet: "sheetname",  // specific sheetname
    rowsToSkip: 5 // number of rows to skip at the top of the sheet; defaults to 0
  }, function(err, result) {
    if(err) {
      console.error(err);
    } else {
      console.log(result);
    }
  });

动态生成语言包

  langBuild = require("cj-lang-build");
  langBuild.langBuild({
    input_temp: "en", // 不传走code码为key  "en"是以英文文案为key 其他值代表对照表的路径
    output: "lang/language/{{ens}}/local.json" // 生成语言包的路径 -必填
  }, function(err, result) {
    if(err) {
      console.error(err);
    } else {
      console.log(result);
    }
  });

生成全局语言包--基于jobs为基础

  langBuild = require("cj-lang-build");
  langBuild.langBuildNew({
    apiUrl:'http://host/world/findByApplicationId', // api地址
    appId: '1305748467817271296' // 项目应用Id
    outPath: 'locales' // 输出词库目录
  }, function(err, result) {
    if(err) {
      console.error(err);
    } else {
      console.log(result);
    }
  });

Readme

Keywords

Package Sidebar

Install

npm i cj-lang-build

Weekly Downloads

11

Version

1.1.1

License

ISC

Unpacked Size

8.33 kB

Total Files

5

Last publish

Collaborators

  • fengwangs