chain33errori18n
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,11 +5,5 @@ export declare const docMsgs: any; | ||
* @param {string} code 错误码 | ||
* @param {string} [lang='zh'] zh: 中午, en: 英文 | ||
* @returns | ||
*/ | ||
/** | ||
* @description 翻译chain33 接口错误码 | ||
* @param {string} code 错误码 | ||
* @param {string} [lang='zh'] zh: 中午, en: 英文 | ||
* @param {string} [lang='zh'] zh: 中文, en: 英文 | ||
* @returns {string} 译文,如果没有对应的译文则返回原文 | ||
*/ | ||
export default function errorMsg(code: string, lang?: string): string; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -99,3 +110,3 @@ exports.docMsgs = { | ||
"ErrNewKeyPair": { "en": "New Key Pair", "zh": "创建私钥公钥对错误" }, | ||
"ErrPrivkeyToPub": { "en": "Privkey To Pub", "zh": "私钥生成公钥错误" }, | ||
"ErrPrivkeyToPub": { "en": "Privkey To Pub Error", "zh": "私钥生成公钥错误" }, | ||
"ErrNoExecerInMavlKey": { "en": "", "zh": "" }, | ||
@@ -176,12 +187,10 @@ "ErrMavlKeyNotStartWithMavl": { "en": "", "zh": "" }, | ||
}; | ||
// 补充错误码请写在这 | ||
var complementaryMsgs = { | ||
"ErrPrivkeyToPub": { "en": "Privkey To Pub", "zh": "私钥生成公钥错误" }, | ||
}; | ||
/** | ||
* @description 翻译chain33 接口错误码 | ||
* @param {string} code 错误码 | ||
* @param {string} [lang='zh'] zh: 中午, en: 英文 | ||
* @returns | ||
*/ | ||
/** | ||
* @description 翻译chain33 接口错误码 | ||
* @param {string} code 错误码 | ||
* @param {string} [lang='zh'] zh: 中午, en: 英文 | ||
* @param {string} [lang='zh'] zh: 中文, en: 英文 | ||
* @returns {string} 译文,如果没有对应的译文则返回原文 | ||
@@ -191,4 +200,5 @@ */ | ||
if (lang === void 0) { lang = 'zh'; } | ||
if (exports.docMsgs[code] && exports.docMsgs[code][lang]) { | ||
return exports.docMsgs[code][lang]; | ||
var msgs = __assign({}, exports.docMsgs, complementaryMsgs); | ||
if (msgs[code] && msgs[code][lang]) { | ||
return msgs[code][lang]; | ||
} | ||
@@ -195,0 +205,0 @@ else { |
{ | ||
"name": "chain33errori18n", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "chain33 接口错误码中英文翻译", | ||
@@ -5,0 +5,0 @@ "main": "dist/errorMsg.js", |
## chain33 rpc 接口错误信息翻译 | ||
使用方式 | ||
### 使用方式 | ||
@@ -10,2 +10,12 @@ ``` | ||
let zh = errMsg('ErrDupTx', 'zh') | ||
``` | ||
``` | ||
### 开发 | ||
#### 更新文档错误码 | ||
运行 ```npm run get-latest``` | ||
复制codeoutput.txt中生成的代码,覆盖到errorMsg.ts 的docMsgs中。 | ||
#### 补充文档中没有或错误的错误码 | ||
在 errorMsg.ts 的 complementaryMsgs 中补充, | ||
**不要直接修改docMsgs中的代码,因为更新文档的错误码后会导致其中的修改消失** |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32981
274
21
0