b28-cli 1.6.7 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +24 -9
- package/dist/ExtractFileOrigin.js +96 -6
- package/dist/cmd.js +251 -158
- package/dist/debug/test.js +18 -1
- package/dist/extractOrigin/extract.js +55 -102
- package/dist/extractOrigin/extract_html_ori.js +58 -32
- package/dist/extractOrigin/extract_js_ori.js +34 -385
- package/dist/handle.js +3 -1
- package/dist/index.js +0 -0
- package/dist/util/config.js +11 -1
- package/dist/util/index.js +17 -2
- package/index.js +0 -0
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -256,21 +256,31 @@ module.exports = {
|
|
|
256
256
|
|
|
257
257
|
### 原厂代码添加翻译函数
|
|
258
258
|
|
|
259
|
-
在原厂代码中添加翻译函数`_()
|
|
259
|
+
在原厂代码中添加翻译函数`_()`,实现多语言产品需求,同时生成初始的语言包`json`文件。
|
|
260
|
+
|
|
261
|
+

|
|
262
|
+
|
|
263
|
+
对于无法识别的内容或风险内容,输出到`log.txt`文件,手动检查是否需要添加翻译函数。
|
|
264
|
+
`log.txt`中存在三种类型的log:
|
|
265
|
+
- **词条不存在**:词条标识字段无法在C文件中找到对应的英文描述词条;
|
|
266
|
+
- **翻译函数缺失?**:当前语句可能需要添加翻译函数,如要添加,请根据提供的文件信息找到当前语句手动添加翻译函数;
|
|
267
|
+
- **文件检查**:当前文件添加翻译函数后可能会存在一定的语法错误,请根据提供的文件信息,找到文件手动检查修正。(问题代码大概率出现在js代码中的html字符串拼接部分)
|
|
260
268
|
|
|
261
269
|
| 属性 | 值类型 | 默认值 | 说明 |
|
|
262
270
|
| -------------- | --------------------------- | -------------------- | --------------------------------------------------- |
|
|
263
|
-
| baseProPath | String | `必填` | 原厂代码地址 |
|
|
264
|
-
| baseProOutPath | String | `baseProPath` | 添加翻译函数后文件输出地址 |
|
|
265
|
-
|
|
|
266
|
-
|
|
|
267
|
-
|
|
|
271
|
+
| baseProPath | `String` | `必填` | 原厂代码地址 |
|
|
272
|
+
| baseProOutPath | `String` | `baseProPath` | 添加翻译函数后文件输出地址 |
|
|
273
|
+
| templateExp | `String`/`Regexp` | `/<%\s*multilang\(([^\n]*?)\);*\s*%>/g` | JS 文件中后台用于插入替换的模板表达式对应的正则 |
|
|
274
|
+
| enPath | `String` | `必填` | 原厂代码存储英文词条的C文件地址: |
|
|
275
|
+
| otherLangPath | `String` | - | 原厂代码存储其它语言词条的C文件地址 |
|
|
268
276
|
|
|
269
|
-
> `
|
|
277
|
+
> `templateExp`: 原厂中没有实现前后端分离,通过特定的模板语法注入参数的代码段对应的`正则`,如`/<%\s*multilang\(([^\n]*?)\);*\s*%>/g`,正则只能存在一个捕获组。捕获组的内容为占位符,例如源码占位符`<% multilang(LANG_LOGIN_USER); %>`中的`LANG_LOGIN_USER`为捕获组的内容
|
|
270
278
|
>
|
|
271
|
-
> `
|
|
279
|
+
> `enPath`: 原原厂代码存储英文词条的C文件地址,用于找到模板语法中的占位符对应的词条,例如`multilang_en_EN.c`文件
|
|
272
280
|
>
|
|
273
|
-
> `
|
|
281
|
+
> `otherLangPath`: 原厂代码存储其它语言词条的C文件地址,多个文件用逗号连接,用于生成初始语言包json文件
|
|
282
|
+
|
|
283
|
+
|
|
274
284
|
|
|
275
285
|
**预设不进行翻译配置如下**
|
|
276
286
|
|
|
@@ -282,6 +292,7 @@ module.exports = {
|
|
|
282
292
|
- 全大写字母
|
|
283
293
|
- url
|
|
284
294
|
- 数字,字母,特殊符号(不包含空格)组成的字符串,必须包含[数字,=,?]中的一个
|
|
295
|
+
>>>>>>> 7b6d160444e451fcb078542162ed451f53be2fb9
|
|
285
296
|
|
|
286
297
|
### 提取全部词条及其对应全部翻译
|
|
287
298
|
|
|
@@ -380,6 +391,10 @@ b28-cli
|
|
|
380
391
|
|
|
381
392
|
## 更新日志
|
|
382
393
|
|
|
394
|
+
#### 【2021.8.19】
|
|
395
|
+
|
|
396
|
+
- 添加`Vue`自定义指令支持
|
|
397
|
+
- 修复已知bug(Vue bind中使用运算符词条解析出错)
|
|
383
398
|
#### 【2020.11.19】
|
|
384
399
|
|
|
385
400
|
- 添加`ts`语法支持
|
|
@@ -41,13 +41,18 @@ var ExtractFile = function () {
|
|
|
41
41
|
|
|
42
42
|
this.option = Object.assign({}, {
|
|
43
43
|
baseReadPath: "",
|
|
44
|
-
baseWritePath: ""
|
|
44
|
+
baseWritePath: "",
|
|
45
|
+
enPath: "",
|
|
46
|
+
otherLangPath: [""]
|
|
45
47
|
}, option);
|
|
46
48
|
|
|
47
49
|
this.option.baseReadPath = (0, _index.correctPath)(this.option.baseReadPath);
|
|
48
|
-
this.option.baseWritePath = (0, _index.correctPath)(this.option.baseWritePath);
|
|
49
|
-
this.option.baseWritePath = _path2.default.join(this.option.baseWritePath, "outSrc");
|
|
50
|
+
this.option.baseWritePath = _path2.default.join((0, _index.correctPath)(this.option.baseWritePath), "outSrc");
|
|
50
51
|
this.option.needCopy = true;
|
|
52
|
+
this.enPath = (0, _index.correctPath)(this.option.enPath);
|
|
53
|
+
this.otherLangPath = this.option.otherLangPath.map(function (item) {
|
|
54
|
+
return (0, _index.correctPath)(item);
|
|
55
|
+
});
|
|
51
56
|
|
|
52
57
|
this.fileList = {
|
|
53
58
|
// 需要进行提取和翻译的文件
|
|
@@ -69,13 +74,16 @@ var ExtractFile = function () {
|
|
|
69
74
|
this.option.ignoreCode && (obj.ignoreCode = this.option.ignoreCode);
|
|
70
75
|
this.option.templateExp && (obj.templateExp = this.option.templateExp);
|
|
71
76
|
|
|
72
|
-
this.
|
|
73
|
-
|
|
74
|
-
this.extractJS = new _extract_js_ori2.default(obj);
|
|
77
|
+
this.getWord();
|
|
78
|
+
this.extractHTML = new _extract_html_ori2.default(obj, this.words);
|
|
79
|
+
this.extractJS = new _extract_js_ori2.default(obj, this.words);
|
|
75
80
|
|
|
76
81
|
(0, _index.createFolder)(this.option.baseWritePath);
|
|
77
82
|
};
|
|
78
83
|
|
|
84
|
+
// 入口函数
|
|
85
|
+
|
|
86
|
+
|
|
79
87
|
ExtractFile.prototype.scanFile = function scanFile() {
|
|
80
88
|
var _this = this;
|
|
81
89
|
|
|
@@ -106,7 +114,15 @@ var ExtractFile = function () {
|
|
|
106
114
|
|
|
107
115
|
// 将提取的词条文件,输出为excel
|
|
108
116
|
return Promise.all([this.handleHtml(), this.handleJs()]).then(function (data) {
|
|
117
|
+
var suspectLine = "";
|
|
118
|
+
data.forEach(function (item) {
|
|
119
|
+
suspectLine += "\n\r" + item.join("\n\r");
|
|
120
|
+
});
|
|
121
|
+
var suspectPath = _path2.default.join(_this.option.baseWritePath, "log.txt");
|
|
122
|
+
(0, _index.writeTextFile)(suspectPath, suspectLine);
|
|
123
|
+
(0, _index.log)("\u6DFB\u52A0\u7FFB\u8BD1\u51FD\u6570\u8FC7\u7A0B\u4E2D\u9700\u8981\u624B\u52A8\u6392\u67E5\u95EE\u9898log\uFF1A" + suspectPath, _index.LOG_TYPE.DONE);
|
|
109
124
|
//重置
|
|
125
|
+
_this.exportLangs();
|
|
110
126
|
_this.reset();
|
|
111
127
|
(0, _index.log)("\u5904\u7406\u5B8C\u6210", _index.LOG_TYPE.DONE);
|
|
112
128
|
return _this.outData;
|
|
@@ -181,6 +197,80 @@ var ExtractFile = function () {
|
|
|
181
197
|
}
|
|
182
198
|
};
|
|
183
199
|
|
|
200
|
+
ExtractFile.prototype.getWord = function getWord() {
|
|
201
|
+
var _this4 = this;
|
|
202
|
+
|
|
203
|
+
this.words = this.analyseWord(this.enPath);
|
|
204
|
+
this.otherLang = {};
|
|
205
|
+
this.otherLangPath.forEach(function (filePath) {
|
|
206
|
+
var lang = _path2.default.basename(filePath, _path2.default.extname(filePath));
|
|
207
|
+
_this4.otherLang[lang] = _this4.analyseWord(filePath);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
ExtractFile.prototype.analyseWord = function analyseWord(filePath) {
|
|
212
|
+
var str = (0, _index.loadFileSync)(filePath);
|
|
213
|
+
|
|
214
|
+
if (typeof str !== "string") {
|
|
215
|
+
(0, _index.log)("\u6587\u4EF6[" + filePath + "]\u5904\u7406\u51FA\u9519- " + str.message, _index.LOG_TYPE.ERROR);
|
|
216
|
+
this.copyFile(filePath);
|
|
217
|
+
return {};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var obj = {};
|
|
221
|
+
str = str.match(/\{([\s\S]*?)\}/g);
|
|
222
|
+
if (str === null) {
|
|
223
|
+
return obj;
|
|
224
|
+
}
|
|
225
|
+
str = str[0];
|
|
226
|
+
str = str.replace(/(^\s*\{})|(\s*\}$)/g, "").split(/\n|\r/);
|
|
227
|
+
str.forEach(function (item) {
|
|
228
|
+
item.replace(/\[(.*?)\]\s*=\s*"(.*?)"/g, function (m, a, b) {
|
|
229
|
+
if (b !== "") {
|
|
230
|
+
obj[a] = b;
|
|
231
|
+
}
|
|
232
|
+
return m;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
return obj;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
ExtractFile.prototype.exportLangs = function exportLangs() {
|
|
239
|
+
if (this.otherLangPath.length === 0) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
var outJson = {};
|
|
243
|
+
for (var key in this.otherLang) {
|
|
244
|
+
outJson[key] = {};
|
|
245
|
+
}
|
|
246
|
+
for (var _iterator = Object.entries(this.words), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
247
|
+
var _ref;
|
|
248
|
+
|
|
249
|
+
if (_isArray) {
|
|
250
|
+
if (_i >= _iterator.length) break;
|
|
251
|
+
_ref = _iterator[_i++];
|
|
252
|
+
} else {
|
|
253
|
+
_i = _iterator.next();
|
|
254
|
+
if (_i.done) break;
|
|
255
|
+
_ref = _i.value;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var _ref2 = _ref,
|
|
259
|
+
_key2 = _ref2[0],
|
|
260
|
+
value = _ref2[1];
|
|
261
|
+
|
|
262
|
+
for (var lang in this.otherLang) {
|
|
263
|
+
outJson[lang][value] = this.otherLang[lang][_key2];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
for (var _key in outJson) {
|
|
268
|
+
var filePath = _path2.default.join(this.option.baseWritePath, "exportLang", _key + ".json");
|
|
269
|
+
(0, _index.log)("\u5199\u5165\u8BED\u8A00\u5305\u6587\u4EF6[" + filePath + "]", _index.LOG_TYPE.DONE);
|
|
270
|
+
(0, _index.writeJson)(outJson[_key], filePath);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
184
274
|
return ExtractFile;
|
|
185
275
|
}();
|
|
186
276
|
|
package/dist/cmd.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
|
|
5
|
-
var _ref;
|
|
6
|
-
|
|
7
5
|
var _package = require("../package.json");
|
|
8
6
|
|
|
9
7
|
var _package2 = _interopRequireDefault(_package);
|
|
@@ -72,161 +70,256 @@ var comments = {
|
|
|
72
70
|
/**
|
|
73
71
|
* 命令行手动输入参数逐条配置
|
|
74
72
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
73
|
+
// let questions = [
|
|
74
|
+
// // 提取词条
|
|
75
|
+
// [
|
|
76
|
+
// {
|
|
77
|
+
// type: "confirm",
|
|
78
|
+
// name: "onlyZH",
|
|
79
|
+
// message: "只提取中文?"
|
|
80
|
+
// },
|
|
81
|
+
// {
|
|
82
|
+
// type: "input",
|
|
83
|
+
// name: "baseReadPath",
|
|
84
|
+
// message: "待提取文件地址:"
|
|
85
|
+
// },
|
|
86
|
+
// {
|
|
87
|
+
// type: "input",
|
|
88
|
+
// name: "baseOutPath",
|
|
89
|
+
// message: "提取的Excel文件输出地址:"
|
|
90
|
+
// },
|
|
91
|
+
// {
|
|
92
|
+
// type: "input",
|
|
93
|
+
// name: "hongPath",
|
|
94
|
+
// message: "宏文件地址:"
|
|
95
|
+
// }
|
|
96
|
+
// ],
|
|
97
|
+
// // 翻译文件
|
|
98
|
+
// [
|
|
99
|
+
// {
|
|
100
|
+
// type: "input",
|
|
101
|
+
// name: "baseTranslatePath",
|
|
102
|
+
// message: "待翻译文件根目录:"
|
|
103
|
+
// },
|
|
104
|
+
// {
|
|
105
|
+
// type: "input",
|
|
106
|
+
// name: "baseTransOutPath",
|
|
107
|
+
// message: "翻译后文件输出根目录:"
|
|
108
|
+
// },
|
|
109
|
+
// {
|
|
110
|
+
// type: "input",
|
|
111
|
+
// name: "hongPath",
|
|
112
|
+
// message: "宏文件地址:"
|
|
113
|
+
// },
|
|
114
|
+
// {
|
|
115
|
+
// type: "input",
|
|
116
|
+
// name: "languagePath",
|
|
117
|
+
// message: "语言包文件地址:"
|
|
118
|
+
// },
|
|
119
|
+
// {
|
|
120
|
+
// type: "input",
|
|
121
|
+
// name: "sheetName",
|
|
122
|
+
// message: "Excel中对应的sheet:"
|
|
123
|
+
// },
|
|
124
|
+
// {
|
|
125
|
+
// type: "input",
|
|
126
|
+
// name: "keyName",
|
|
127
|
+
// message: "key对应列:", //指代代码中的词条需要被那一列的数据替换
|
|
128
|
+
// default: "EN"
|
|
129
|
+
// },
|
|
130
|
+
// {
|
|
131
|
+
// type: "input",
|
|
132
|
+
// name: "valueName",
|
|
133
|
+
// message: "value对应列:", //指代代码中目前需要被替换的语言
|
|
134
|
+
// default: "CN", // ALL代表所有
|
|
135
|
+
// default: ""
|
|
136
|
+
// }
|
|
137
|
+
// ],
|
|
138
|
+
// // 翻译检查
|
|
139
|
+
// [
|
|
140
|
+
// {
|
|
141
|
+
// type: "input",
|
|
142
|
+
// name: "baseCheckPath",
|
|
143
|
+
// message: "待检查文件根目录:"
|
|
144
|
+
// },
|
|
145
|
+
// {
|
|
146
|
+
// type: "input",
|
|
147
|
+
// name: "langJsonPath",
|
|
148
|
+
// message: "语言包json文件地址:"
|
|
149
|
+
// },
|
|
150
|
+
// {
|
|
151
|
+
// type: "input",
|
|
152
|
+
// name: "hongPath",
|
|
153
|
+
// message: "宏文件地址:"
|
|
154
|
+
// },
|
|
155
|
+
// {
|
|
156
|
+
// type: "input",
|
|
157
|
+
// name: "logPath",
|
|
158
|
+
// message: "检查信息输出路径:"
|
|
159
|
+
// }
|
|
160
|
+
// ],
|
|
161
|
+
// // excel转json
|
|
162
|
+
// [
|
|
163
|
+
// {
|
|
164
|
+
// type: "input",
|
|
165
|
+
// name: "excelPath",
|
|
166
|
+
// message: "Excel文件地址:"
|
|
167
|
+
// },
|
|
168
|
+
// {
|
|
169
|
+
// type: "input",
|
|
170
|
+
// name: "sheetName",
|
|
171
|
+
// message: "Excel中对应的sheet:"
|
|
172
|
+
// },
|
|
173
|
+
// {
|
|
174
|
+
// type: "input",
|
|
175
|
+
// name: "keyName",
|
|
176
|
+
// message: "key对应列:",
|
|
177
|
+
// default: "EN"
|
|
178
|
+
// },
|
|
179
|
+
// {
|
|
180
|
+
// type: "input",
|
|
181
|
+
// name: "valueName",
|
|
182
|
+
// message: "value对应列:" // ALL代表所有
|
|
183
|
+
// },
|
|
184
|
+
// {
|
|
185
|
+
// type: "input",
|
|
186
|
+
// name: "outJsonPath",
|
|
187
|
+
// message: "输出json文件目录:"
|
|
188
|
+
// }
|
|
189
|
+
// ],
|
|
190
|
+
// // json转excel
|
|
191
|
+
// [
|
|
192
|
+
// {
|
|
193
|
+
// type: "input",
|
|
194
|
+
// name: "jsonPath",
|
|
195
|
+
// message: "json文件地址:"
|
|
196
|
+
// },
|
|
197
|
+
// {
|
|
198
|
+
// type: "input",
|
|
199
|
+
// name: "outExcelPath",
|
|
200
|
+
// message: "输出Excel文件目录:"
|
|
201
|
+
// }
|
|
202
|
+
// ],
|
|
203
|
+
// // json文件合并
|
|
204
|
+
// [
|
|
205
|
+
// {
|
|
206
|
+
// type: "input",
|
|
207
|
+
// name: "mainJsonPath",
|
|
208
|
+
// message: "主json文件地址:"
|
|
209
|
+
// },
|
|
210
|
+
// {
|
|
211
|
+
// type: "input",
|
|
212
|
+
// name: "mergeJsonPath",
|
|
213
|
+
// message: "次json文件地址:"
|
|
214
|
+
// },
|
|
215
|
+
// {
|
|
216
|
+
// type: "input",
|
|
217
|
+
// name: "outMergeJsonPath",
|
|
218
|
+
// message: "合并后输出的地址:"
|
|
219
|
+
// }
|
|
220
|
+
// ],
|
|
221
|
+
// // 原厂代码添加翻译函数
|
|
222
|
+
// [
|
|
223
|
+
// {
|
|
224
|
+
// type: "input",
|
|
225
|
+
// name: "baseProPath",
|
|
226
|
+
// message: "原厂代码地址:"
|
|
227
|
+
// },
|
|
228
|
+
// {
|
|
229
|
+
// type: "input",
|
|
230
|
+
// name: "baseProOutPath",
|
|
231
|
+
// message: "添加翻译函数后文件输出地址:"
|
|
232
|
+
// },
|
|
233
|
+
// {
|
|
234
|
+
// type: "input",
|
|
235
|
+
// name: "ignoreCode",
|
|
236
|
+
// message: "需要注释的代码正则:",
|
|
237
|
+
// default: "/<!--s*hide|-->/g"
|
|
238
|
+
// },
|
|
239
|
+
// {
|
|
240
|
+
// type: "input",
|
|
241
|
+
// name: "templateExp",
|
|
242
|
+
// message: "后台插入表达式正则:",
|
|
243
|
+
// default: "/<%([^\n]*?)%>/g"
|
|
244
|
+
// }
|
|
245
|
+
// ],
|
|
246
|
+
// // 提取json文件,生成一个excel表格
|
|
247
|
+
// [
|
|
248
|
+
// {
|
|
249
|
+
// type: "input",
|
|
250
|
+
// name: "baseReadPath",
|
|
251
|
+
// message: "待提取文件地址:",
|
|
252
|
+
// validate: valid.folder // 必填,可以是文件也可以是文件夹
|
|
253
|
+
// },
|
|
254
|
+
// {
|
|
255
|
+
// type: "input",
|
|
256
|
+
// name: "languagePath",
|
|
257
|
+
// message: "语言包文地址(文件夹):"
|
|
258
|
+
// },
|
|
259
|
+
// {
|
|
260
|
+
// type: "input",
|
|
261
|
+
// name: "baseOutPath",
|
|
262
|
+
// message: "提取的Excel文件输出地址:",
|
|
263
|
+
// default(answers) {
|
|
264
|
+
// return getDirname(answers.baseReadPath);
|
|
265
|
+
// }
|
|
266
|
+
// },
|
|
267
|
+
// {
|
|
268
|
+
// type: "input",
|
|
269
|
+
// name: "hongPath",
|
|
270
|
+
// message: "宏文件地址:",
|
|
271
|
+
// default: ""
|
|
272
|
+
// }
|
|
273
|
+
// ],
|
|
274
|
+
// // 翻译文件检查
|
|
275
|
+
// [
|
|
276
|
+
// {
|
|
277
|
+
// type: "input",
|
|
278
|
+
// name: "outExcel",
|
|
279
|
+
// message: "输出的excel文件地址:",
|
|
280
|
+
// default: "C:\\Users\\Administrator\\Desktop\\a.xlsx"
|
|
281
|
+
// },
|
|
282
|
+
// {
|
|
283
|
+
// type: "input",
|
|
284
|
+
// name: "inExcel",
|
|
285
|
+
// message: "最终excel文件地址:",
|
|
286
|
+
// default: "C:\\Users\\Administrator\\Desktop\\b.xlsx"
|
|
287
|
+
// },
|
|
288
|
+
// {
|
|
289
|
+
// type: "input",
|
|
290
|
+
// name: "baseCheckPath",
|
|
291
|
+
// message: "待检查文件根目录:"
|
|
292
|
+
// },
|
|
293
|
+
// {
|
|
294
|
+
// type: "input",
|
|
295
|
+
// name: "jsonPath",
|
|
296
|
+
// message: "语言包文件夹地址:"
|
|
297
|
+
// },
|
|
298
|
+
// {
|
|
299
|
+
// type: "input",
|
|
300
|
+
// name: "outExcelPath",
|
|
301
|
+
// message: "输出Excel文件目录:"
|
|
302
|
+
// }
|
|
303
|
+
// ],
|
|
304
|
+
// // 文件转码
|
|
305
|
+
// [
|
|
306
|
+
// {
|
|
307
|
+
// type: "input",
|
|
308
|
+
// name: "transFilePath",
|
|
309
|
+
// message: "待转码文件地址"
|
|
310
|
+
// },
|
|
311
|
+
// {
|
|
312
|
+
// type: "input",
|
|
313
|
+
// name: "transOutPath",
|
|
314
|
+
// message: "转码后文件输出地址"
|
|
315
|
+
// },
|
|
316
|
+
// {
|
|
317
|
+
// type: "input",
|
|
318
|
+
// name: "transEncode",
|
|
319
|
+
// message: "转码后文件的编码方式(默认UTF-8)"
|
|
320
|
+
// }
|
|
321
|
+
// ]
|
|
322
|
+
// ];
|
|
230
323
|
|
|
231
324
|
/**
|
|
232
325
|
* 初始化b28.config.js文件
|
|
@@ -235,7 +328,7 @@ function handleInit() {
|
|
|
235
328
|
var config = {};
|
|
236
329
|
inquirer.prompt(_config.baseQuestions).then(function (answers) {
|
|
237
330
|
config.commandType = answers.commandType;
|
|
238
|
-
return inquirer.prompt(questions[answers.commandType]);
|
|
331
|
+
return inquirer.prompt(_config.questions[answers.commandType]);
|
|
239
332
|
}).then(function (answers) {
|
|
240
333
|
answers = Object.assign({}, config, answers);
|
|
241
334
|
return answers;
|
package/dist/debug/test.js
CHANGED
|
@@ -212,8 +212,22 @@ function transAllFile() {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
function transOrigin() {
|
|
216
|
+
(0, _index2.default)({
|
|
217
|
+
commandType: _config.COMMAD.ORIGINAL_CODE,
|
|
218
|
+
baseProPath: "D:/Desktop/trans/test/web",
|
|
219
|
+
baseProOutPath: "D:/Desktop/trans/test",
|
|
220
|
+
enPath: "D:/Desktop/trans/test/server/multilang_en_EN.c",
|
|
221
|
+
otherLangPath: "D:/Desktop/trans/test/server/multilang_ru_RU.c,D:/Desktop/trans/test/server/multilang_zh_CN.c"
|
|
222
|
+
// ignoreCode:"",
|
|
223
|
+
// templateExp: /<%([^\n]*?)%>/g
|
|
224
|
+
}).then(function (data) {
|
|
225
|
+
var t = data;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
215
229
|
module.exports = function () {
|
|
216
|
-
var command = "
|
|
230
|
+
var command = "origin";
|
|
217
231
|
switch (command) {
|
|
218
232
|
case "check":
|
|
219
233
|
check();
|
|
@@ -279,5 +293,8 @@ module.exports = function () {
|
|
|
279
293
|
case "getWord":
|
|
280
294
|
getWords();
|
|
281
295
|
break;
|
|
296
|
+
case "origin":
|
|
297
|
+
transOrigin();
|
|
298
|
+
break;
|
|
282
299
|
}
|
|
283
300
|
};
|