New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

langparse

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langparse

parse language

latest
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

Langparse 使用说明

安装

npm install --save-dev langparse

设置命令

在项目 package.json 的 script 中增加如下命令

"lang": "node ./node_modules/langparse/index.js"

初始化

公共配置初始化

npm run lang init

会在项目最外层生成如下文件

|-- langConfig
        |-- baseConfig.js // 有关项目的基础设置
        |-- defaultConfig.js // 编译文本的初始设置
        |-- README.md // 使用说明

快速使用

// init 之后可执行
npm run lang

子项目 [projectName] 初始化

npm run lang init [projectName]

会在 baseConfig.js 配置好的子项目位置中创建

|-- langConfig.js // 编译文本的项目设置

langparse 有两个使用层级,必须进行对应 init 之后才能使用

  • 默认层级 npm run lang。将以 langConfig 为执行目录,使用 defaultConfig.js 作为配置
  • 子项目层级 npm run lang [projectName]。将以 baseConfig.js 中配置定位到对应子目录,以子目录中的 langConfig.js 作为配置执行

配置说明

baseConfig.js

字段默认值功能
projectDir./do.config.js指定一个文件,在此文件中,可以详细配置子项目的文件路径
dirKeylangDir详情如下
proKey["deploy"]假设根据 projectDir 读取到了配置文件 config,子项目详细目录位置为 config["deploy"][projectName][dirKey]
comDirproject如果没有获取上述值,子项目详细目录位置为 [langConfig 所在目录]/project/[projectName]

defaultConfig.js | langConfig.js

假设有例句:this xxx still need to slash ฿xxx.xx more to get this product

字段默认值功能
langNameKeyen_US与 lang 对应,英文的名称
lang["zh_CN", "en_US", "th_TH"]excal 中的语言顺序,同时也是输出的文件名
langPre输出的文件名前缀 [langPre]zh_CN.js (输出会直接覆盖同名文件,请输出前自行确认)
langInstrue输出的文件是否需要增加 insert 函数
entryFile./input.xlsx相对 ...Config.js 的输入文件位置
outFileNameoutput相对 ...Config.js 的输出文件夹位置
maxWordNum6key 值最大单词长度(不计入_) 3 => this_StillNeed...
insertReservedtrue是否需要替换 xx
例1:"true" => this {0} still need to slash {1} more to get this product
例2:"false" => this xx still need to slash ฿xx.xx more to get this product
currencySymbol是否需要替换货币符,insertReserved = true 时此设置才生效
例1:"¥$฿" => this {0} still need to slash {1} more to get this product
例2:"" => this {0} still need to slash ฿{1} more to get this product
keyStylespace命名风格 3 => this_StillNeed...
例1:"Camel" => this_StillNeedToSlash_More...
例2:"Pascal" => This_StillNeedToSlash_More...
例3:"space" => this _ still need to slash _ more...
preStr命名前缀 "[str]" => [str]this_StillNeedToSlash_More...

注: langConfig.js 未配置的部分,会采用 defaultConfig.js 中的值。defaultConfig.js 必须配置每一项

Keywords

langparse

FAQs

Package last updated on 25 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts