@akanjs/dictionary 0.9.48 → 0.9.49
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/cjs/src/base.dictionary.js +55 -2
- package/cjs/src/dictionary.js +2 -1
- package/cjs/src/index.js +2 -2
- package/cjs/src/serverTranslator.js +11 -3
- package/cjs/src/trans.js +4 -222
- package/esm/src/base.dictionary.js +55 -2
- package/esm/src/dictionary.js +2 -1
- package/esm/src/index.js +3 -3
- package/esm/src/serverTranslator.js +11 -3
- package/esm/src/trans.js +5 -233
- package/package.json +1 -1
- package/src/base.dictionary.d.ts +47 -1
- package/src/dictionary.d.ts +60 -8
- package/src/index.d.ts +2 -2
- package/src/serverTranslator.d.ts +13 -4
- package/src/trans.d.ts +8 -2
|
@@ -56,9 +56,13 @@ const baseDictionary = {
|
|
|
56
56
|
"apidesc-getDictionary": ["Get Dictionary", "Get Dictionary"],
|
|
57
57
|
"arg-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
|
|
58
58
|
"argdesc-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
|
|
59
|
+
"api-getAllDictionary": ["Get All Dictionary", "Get All Dictionary"],
|
|
60
|
+
"apidesc-getAllDictionary": ["Get All Dictionary", "Get All Dictionary"],
|
|
61
|
+
"api-getSignals": ["Get Signals", "Get Signals"],
|
|
62
|
+
"apidesc-getSignals": ["Get Signals", "Get Signals"],
|
|
59
63
|
// * ==================== Endpoint ==================== * //
|
|
60
64
|
// * ==================== Etc ==================== * //
|
|
61
|
-
new: ["New", "
|
|
65
|
+
// new: ["New", "신규"],
|
|
62
66
|
somethingWrong: ["Something's wrong!", "\uBB38\uC81C\uAC00 \uC0DD\uACBC\uC5B4\uC694!"],
|
|
63
67
|
connecting: ["Connecting...", "\uC5F0\uACB0 \uC911..."],
|
|
64
68
|
connected: ["Connected!", "\uC5F0\uACB0\uB418\uC5C8\uC2B5\uB2C8\uB2E4!"],
|
|
@@ -68,6 +72,55 @@ const baseDictionary = {
|
|
|
68
72
|
serverHasProblem: ["Maybe your server is having a problem.", "\uC11C\uBC84\uC5D0 \uBB38\uC81C\uAC00 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."],
|
|
69
73
|
checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."],
|
|
70
74
|
success: ["Success", "\uC131\uACF5"],
|
|
71
|
-
failed: ["Failed", "\uC2E4\uD328"]
|
|
75
|
+
failed: ["Failed", "\uC2E4\uD328"],
|
|
76
|
+
processing: ["Processing...", "\uCC98\uB9AC\uC911..."],
|
|
77
|
+
processed: ["Processed", "\uCC98\uB9AC \uC644\uB8CC"],
|
|
78
|
+
noData: ["Empty", "\uBE44\uC5B4\uC788\uC74C"],
|
|
79
|
+
error: ["Error", "\uC624\uB958"],
|
|
80
|
+
invalidValueError: ["Value is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4."],
|
|
81
|
+
emailInvalidError: ["Email is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4."],
|
|
82
|
+
phoneInvalidError: ["Phone is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC804\uD654\uBC88\uD638\uC785\uB2C8\uB2E4."],
|
|
83
|
+
ok: ["OK", "\uD655\uC778"],
|
|
84
|
+
cancel: ["Cancel", "\uCDE8\uC18C"],
|
|
85
|
+
unauthorized: ["Unauthorized", "\uAD8C\uD55C \uC5C6\uC74C"],
|
|
86
|
+
confirmClose: ["Are you sure you want to close the modal?", "\uBAA8\uB2EC\uC744 \uB2EB\uC73C\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?"],
|
|
87
|
+
textTooShortError: ["More than {minlength} characters needed.", "{minlength}\uC790 \uC774\uC0C1 \uD544\uC694\uD569\uB2C8\uB2E4."],
|
|
88
|
+
textTooLongError: ["Less than {maxlength} characters needed.", "{maxlength}\uC790 \uC774\uD558\uB85C \uD544\uC694\uD569\uB2C8\uB2E4."],
|
|
89
|
+
selectTooShortError: ["Select at least {minlength} item(s)", "{minlength}\uAC1C \uC774\uC0C1 \uC120\uD0DD\uD574\uC57C\uD569\uB2C8\uB2E4."],
|
|
90
|
+
selectTooLongError: ["Select at most {maxlength} item(s)", "{maxlength}\uAC1C \uC774\uD558\uB85C \uC120\uD0DD\uD574\uC57C\uD569\uB2C8\uB2E4."],
|
|
91
|
+
numberTooSmallError: ["Value must be greater than {min}", "{min}\uBCF4\uB2E4 \uCEE4\uC57C\uD569\uB2C8\uB2E4."],
|
|
92
|
+
numberTooBigError: ["Value must be less than {max}", "{max}\uBCF4\uB2E4 \uC791\uC544\uC57C\uD569\uB2C8\uB2E4."],
|
|
93
|
+
passwordNotMatchError: ["Password does not match", "\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."],
|
|
94
|
+
selectDateError: ["Please select a date.", "\uB0A0\uC9DC\uB97C \uC120\uD0DD\uD574\uC8FC\uC138\uC694."],
|
|
95
|
+
priceUnit: ["$", "\uC6D0"],
|
|
96
|
+
password: ["Password", "\uBE44\uBC00\uBC88\uD638"],
|
|
97
|
+
passwordConfirm: ["Password Confirm", "\uBE44\uBC00\uBC88\uD638 \uD655\uC778"],
|
|
98
|
+
noOptions: ["Can't find any datas", "\uB370\uC774\uD130\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."],
|
|
99
|
+
addModel: ["Add {model}", "{model} \uCD94\uAC00"],
|
|
100
|
+
createModel: ["Create {model}", "{model} \uC0DD\uC131\uD558\uAE30"],
|
|
101
|
+
createSuccess: ["{model} create success", "{model} \uC0DD\uC131 \uC644\uB8CC"],
|
|
102
|
+
updateModel: ["Update {model}", "{model} \uC218\uC815\uD558\uAE30"],
|
|
103
|
+
removeModel: ["Remove {model}", "{model} \uC0AD\uC81C\uD558\uAE30"],
|
|
104
|
+
updateSuccess: ["{model} update success", "{model} \uC218\uC815 \uC644\uB8CC"],
|
|
105
|
+
removeSuccess: ["{model} removed", "{model} \uC0AD\uC81C \uC644\uB8CC"],
|
|
106
|
+
sureToRemove: [`Are you sure to delete {model} {name}?`, `\uC815\uB9D0\uB85C {name} {model}\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`],
|
|
107
|
+
irreversibleOps: [
|
|
108
|
+
`This operation is irreversible, and all data cannot be backed up.`,
|
|
109
|
+
`\uC774 \uC791\uC5C5\uC740 \uB418\uB3CC\uB9B4 \uC218 \uC5C6\uC73C\uBA70, \uBAA8\uB4E0 \uB370\uC774\uD130\uB294 \uBC31\uC5C5\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`
|
|
110
|
+
],
|
|
111
|
+
typeNameToRemove: [
|
|
112
|
+
`If you want to delete this {model}, please enter the name ({name}) of the {model} to confirm.`,
|
|
113
|
+
`{model} \uC0AD\uC81C\uB97C \uC6D0\uD558\uB294 \uACBD\uC6B0, {name} \uC774\uB984\uC744 \uC785\uB825\uD558\uC138\uC694.`
|
|
114
|
+
],
|
|
115
|
+
yesRemove: ["Yes, remove this {model}", "\uB124, {model} \uC0AD\uC81C\uB97C \uC9C4\uD589\uD569\uB2C8\uB2E4."],
|
|
116
|
+
removeMsg: ["Are you sure to remove?", "\uC815\uB9D0\uB85C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?"],
|
|
117
|
+
confirmMsg: ["Are you sure to {actionType}", "\uC9C4\uD589\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C? ({actionType})"],
|
|
118
|
+
perPage: ["/page", "/\uD398\uC774\uC9C0"],
|
|
119
|
+
actions: ["Actions", "\uC791\uC5C5"],
|
|
120
|
+
new: ["New", "\uC2E0\uADDC"],
|
|
121
|
+
edit: ["Edit", "\uC218\uC815"],
|
|
122
|
+
save: ["Save", "\uC800\uC7A5"],
|
|
123
|
+
remove: ["Remove", "\uC0AD\uC81C"],
|
|
124
|
+
view: ["View", "\uBCF4\uAE30"]
|
|
72
125
|
// * ==================== Etc ==================== * //
|
|
73
126
|
};
|
package/cjs/src/dictionary.js
CHANGED
|
@@ -19,6 +19,7 @@ var dictionary_exports = {};
|
|
|
19
19
|
__export(dictionary_exports, {
|
|
20
20
|
Revert: () => Revert,
|
|
21
21
|
dictionary: () => dictionary,
|
|
22
|
+
getAllDictionary: () => getAllDictionary,
|
|
22
23
|
getDictionary: () => getDictionary,
|
|
23
24
|
msg: () => msg,
|
|
24
25
|
translate: () => translate
|
|
@@ -29,4 +30,4 @@ var import_trans = require("./trans");
|
|
|
29
30
|
const dictionary = {
|
|
30
31
|
base: import_base.baseDictionary
|
|
31
32
|
};
|
|
32
|
-
const { Revert, translate, msg, getDictionary } = (0, import_trans.makeTrans)(dictionary);
|
|
33
|
+
const { Revert, translate, msg, getDictionary, getAllDictionary } = (0, import_trans.makeTrans)(dictionary);
|
package/cjs/src/index.js
CHANGED
|
@@ -20,11 +20,11 @@ var src_exports = {};
|
|
|
20
20
|
__export(src_exports, {
|
|
21
21
|
Revert: () => import_dictionary.Revert,
|
|
22
22
|
dictionary: () => import_dictionary.dictionary,
|
|
23
|
+
getAllDictionary: () => import_dictionary.getAllDictionary,
|
|
23
24
|
getDictionary: () => import_dictionary.getDictionary,
|
|
24
|
-
serverTranslator: () => import_serverTranslator.serverTranslator,
|
|
25
25
|
translate: () => import_dictionary.translate
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
__reExport(src_exports, require("./trans"), module.exports);
|
|
29
29
|
var import_dictionary = require("./dictionary");
|
|
30
|
-
|
|
30
|
+
__reExport(src_exports, require("./serverTranslator"), module.exports);
|
|
@@ -21,19 +21,27 @@ __export(serverTranslator_exports, {
|
|
|
21
21
|
serverTranslator: () => serverTranslator
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(serverTranslator_exports);
|
|
24
|
+
var import_base = require("@akanjs/base");
|
|
24
25
|
var import_common = require("@akanjs/common");
|
|
25
|
-
var import_signal = require("@akanjs/signal");
|
|
26
26
|
class ServerTranslator {
|
|
27
27
|
static #langTransMap = /* @__PURE__ */ new Map();
|
|
28
28
|
async init(lang) {
|
|
29
|
-
await this.#getTranslator(lang);
|
|
29
|
+
const { dictionary } = await this.#getTranslator(lang);
|
|
30
|
+
return { lang: dictionary };
|
|
31
|
+
}
|
|
32
|
+
async initAllLanguages(existingAllDictionary) {
|
|
33
|
+
const allDictionary = existingAllDictionary ?? await (await fetch(`${import_base.baseClientEnv.serverHttpUri}/getAllDictionary`)).json();
|
|
34
|
+
Object.entries(allDictionary).forEach(([lang, dictionary]) => {
|
|
35
|
+
this.setTranslator(lang, dictionary);
|
|
36
|
+
});
|
|
37
|
+
return allDictionary;
|
|
30
38
|
}
|
|
31
39
|
async #getTranslator(lang) {
|
|
32
40
|
const existingTrans = ServerTranslator.#langTransMap.get(lang);
|
|
33
41
|
if (existingTrans)
|
|
34
42
|
return existingTrans;
|
|
35
43
|
import_common.Logger.log("Initialize ServerTranslator");
|
|
36
|
-
const dictionary = await
|
|
44
|
+
const dictionary = await (await fetch(`${import_base.baseClientEnv.serverHttpUri}/getDictionary/${lang}`)).json();
|
|
37
45
|
return this.setTranslator(lang, dictionary);
|
|
38
46
|
}
|
|
39
47
|
hasTranslator(lang) {
|
package/cjs/src/trans.js
CHANGED
|
@@ -18,7 +18,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
18
18
|
var trans_exports = {};
|
|
19
19
|
__export(trans_exports, {
|
|
20
20
|
baseTrans: () => baseTrans,
|
|
21
|
-
checkDictCoverage: () => checkDictCoverage,
|
|
22
21
|
getBaseSignalTrans: () => getBaseSignalTrans,
|
|
23
22
|
makeDictionary: () => makeDictionary,
|
|
24
23
|
makeTrans: () => makeTrans,
|
|
@@ -27,8 +26,6 @@ __export(trans_exports, {
|
|
|
27
26
|
});
|
|
28
27
|
module.exports = __toCommonJS(trans_exports);
|
|
29
28
|
var import_common = require("@akanjs/common");
|
|
30
|
-
var import_constant = require("@akanjs/constant");
|
|
31
|
-
var import_signal = require("@akanjs/signal");
|
|
32
29
|
const baseTrans = {
|
|
33
30
|
id: ["Id", "\uC544\uC774\uB514"],
|
|
34
31
|
"desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
|
|
@@ -100,224 +97,6 @@ const getBaseSignalTrans = (modelName) => {
|
|
|
100
97
|
// * ==================== Endpoint ==================== * //
|
|
101
98
|
};
|
|
102
99
|
};
|
|
103
|
-
const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
|
|
104
|
-
const enumKeyMap = /* @__PURE__ */ new Map();
|
|
105
|
-
modelRefs.forEach((modelRef) => {
|
|
106
|
-
const fieldMetaMap = (0, import_constant.getFieldMetaMap)(modelRef);
|
|
107
|
-
[...fieldMetaMap.values()].forEach((fieldMeta) => {
|
|
108
|
-
if (!fieldMeta.enum)
|
|
109
|
-
return;
|
|
110
|
-
enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
|
|
111
|
-
fieldMeta.enum.forEach((value) => {
|
|
112
|
-
const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
|
|
113
|
-
const modelDict = rootDictionary[modelName];
|
|
114
|
-
const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
|
|
115
|
-
if (!enumDict && !rootEnumDict) {
|
|
116
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
|
|
117
|
-
}
|
|
118
|
-
const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
|
|
119
|
-
const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
|
|
120
|
-
if (!enumDescDict && !rootEnumDescDict) {
|
|
121
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
|
|
127
|
-
const [, fieldKey, ...values] = key.split("-");
|
|
128
|
-
const value = values.join("-");
|
|
129
|
-
if (!enumKeyMap.get(fieldKey)?.has(value)) {
|
|
130
|
-
import_common.Logger.error(
|
|
131
|
-
`\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
const fieldKeySet = /* @__PURE__ */ new Set([
|
|
136
|
-
...modelRefs.map((modelRef) => [...(0, import_constant.getFieldMetaMap)(modelRef).keys()]).flat(),
|
|
137
|
-
...filterRefs.map((filterRef) => Object.keys((0, import_constant.getFilterSortMap)(filterRef))).flat()
|
|
138
|
-
]);
|
|
139
|
-
Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
|
|
140
|
-
const [, fieldKey] = key.split("-");
|
|
141
|
-
if (!fieldKeySet.has(fieldKey))
|
|
142
|
-
import_common.Logger.error(
|
|
143
|
-
`\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
|
|
148
|
-
const argKeyMap = /* @__PURE__ */ new Map();
|
|
149
|
-
sigRefs.forEach((sigRef) => {
|
|
150
|
-
const gqlMetas = (0, import_signal.getGqlMetas)(sigRef);
|
|
151
|
-
gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
|
|
152
|
-
const [argMetas] = (0, import_signal.getArgMetas)(sigRef, gqlMeta.key);
|
|
153
|
-
argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
|
|
154
|
-
argMetas.forEach((argMeta) => {
|
|
155
|
-
const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
|
|
156
|
-
if (!argDict) {
|
|
157
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
|
|
158
|
-
}
|
|
159
|
-
const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
|
|
160
|
-
if (!argDescDict) {
|
|
161
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
|
|
167
|
-
const [, gqlKey, argKey] = key.split("-");
|
|
168
|
-
if (!argKeyMap.get(gqlKey)?.has(argKey))
|
|
169
|
-
import_common.Logger.error(
|
|
170
|
-
`\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
|
|
171
|
-
);
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
const checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
|
|
175
|
-
const qargKeyMap = /* @__PURE__ */ new Map();
|
|
176
|
-
filterRefs.forEach((filterRef) => {
|
|
177
|
-
const filterMetaMap = (0, import_constant.getFilterQueryMap)(filterRef);
|
|
178
|
-
filterMetaMap.forEach((filterMeta) => {
|
|
179
|
-
const filterArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, filterMeta.key);
|
|
180
|
-
qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
|
|
181
|
-
filterArgMetas.forEach((filterArgMeta) => {
|
|
182
|
-
const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
|
|
183
|
-
if (!qargDict)
|
|
184
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
|
|
185
|
-
const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
|
|
186
|
-
if (!qargDescDict)
|
|
187
|
-
import_common.Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
|
|
192
|
-
const [, filterKey, filterArgKey] = key.split("-");
|
|
193
|
-
if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
|
|
194
|
-
import_common.Logger.error(
|
|
195
|
-
`\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
|
|
196
|
-
);
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
const checkDictCoverage = () => {
|
|
200
|
-
const fullModelRefEntries = (0, import_constant.getAllFullModelRefs)().filter((modelRef) => {
|
|
201
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
202
|
-
return classMeta.type === "full" && classMeta.modelType === "data";
|
|
203
|
-
}).map((modelRef) => {
|
|
204
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
205
|
-
const modelName = (0, import_common.lowerlize)(classMeta.refName);
|
|
206
|
-
return { modelName, modelRef };
|
|
207
|
-
});
|
|
208
|
-
const scalarModelRefs = (0, import_constant.getAllScalarModelRefs)();
|
|
209
|
-
const insightModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "insight").map((modelRef) => {
|
|
210
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
211
|
-
if (!classMeta.refName.endsWith("Insight"))
|
|
212
|
-
throw new Error(`Invalid insight model name: ${classMeta.refName}`);
|
|
213
|
-
const modelName = (0, import_common.lowerlize)(classMeta.refName.slice(0, -7));
|
|
214
|
-
return { modelName, modelRef };
|
|
215
|
-
});
|
|
216
|
-
const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "data").map((modelRef) => {
|
|
217
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
218
|
-
const modelName = (0, import_common.lowerlize)(classMeta.refName);
|
|
219
|
-
return { modelName, modelRef };
|
|
220
|
-
});
|
|
221
|
-
const filterModelRefEntries = (0, import_constant.getAllFilterModelRefs)().map((filterModelRef) => {
|
|
222
|
-
const filterMeta = (0, import_constant.getFilterMeta)(filterModelRef);
|
|
223
|
-
if (!filterMeta.refName.endsWith("Filter"))
|
|
224
|
-
throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
|
|
225
|
-
const modelName = (0, import_common.lowerlize)(filterMeta.refName.slice(0, -6));
|
|
226
|
-
return { modelName, filterModelRef };
|
|
227
|
-
});
|
|
228
|
-
const signalRefs = (0, import_signal.getAllSignalRefs)();
|
|
229
|
-
const fullModelSignalRefEntries = signalRefs.filter((ref) => {
|
|
230
|
-
const sigMeta = (0, import_signal.getSigMeta)(ref);
|
|
231
|
-
if (!sigMeta.returns)
|
|
232
|
-
return false;
|
|
233
|
-
const modelRef = sigMeta.returns();
|
|
234
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
235
|
-
return classMeta.type === "full";
|
|
236
|
-
}).map((sigRef) => {
|
|
237
|
-
const sigMeta = (0, import_signal.getSigMeta)(sigRef);
|
|
238
|
-
const modelName = (0, import_common.lowerlize)(sigMeta.refName);
|
|
239
|
-
return { modelName, sigRef };
|
|
240
|
-
});
|
|
241
|
-
const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
|
|
242
|
-
const sigMeta = (0, import_signal.getSigMeta)(ref);
|
|
243
|
-
if (!sigMeta.returns)
|
|
244
|
-
return false;
|
|
245
|
-
const modelRef = sigMeta.returns();
|
|
246
|
-
const classMeta = (0, import_constant.getClassMeta)(modelRef);
|
|
247
|
-
return classMeta.type === "scalar";
|
|
248
|
-
}).map((sigRef) => {
|
|
249
|
-
const sigMeta = (0, import_signal.getSigMeta)(sigRef);
|
|
250
|
-
const modelName = (0, import_common.lowerlize)(sigMeta.refName);
|
|
251
|
-
return { modelName, sigRef };
|
|
252
|
-
});
|
|
253
|
-
const pureSignalRefEntries = signalRefs.filter((ref) => !(0, import_signal.getSigMeta)(ref).returns).map((sigRef) => {
|
|
254
|
-
const sigMeta = (0, import_signal.getSigMeta)(sigRef);
|
|
255
|
-
const modelName = (0, import_common.lowerlize)(sigMeta.refName);
|
|
256
|
-
return { modelName, sigRef };
|
|
257
|
-
});
|
|
258
|
-
const modelDictExamMap = /* @__PURE__ */ new Map();
|
|
259
|
-
const scalarDictExamMap = /* @__PURE__ */ new Map();
|
|
260
|
-
const signalDictExamMap = /* @__PURE__ */ new Map();
|
|
261
|
-
const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
|
|
262
|
-
fullModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
263
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
264
|
-
modelDictExam.modelRefs.push(modelRef);
|
|
265
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
266
|
-
});
|
|
267
|
-
insightModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
268
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
269
|
-
modelDictExam.insightRefs.push(modelRef);
|
|
270
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
271
|
-
});
|
|
272
|
-
fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
273
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
274
|
-
modelDictExam.sigRefs.push(sigRef);
|
|
275
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
276
|
-
});
|
|
277
|
-
filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
|
|
278
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
279
|
-
modelDictExam.filterRefs.push(filterModelRef);
|
|
280
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
281
|
-
});
|
|
282
|
-
const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
|
|
283
|
-
pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
284
|
-
const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
|
|
285
|
-
scalarDictExam.modelRefs.push(modelRef);
|
|
286
|
-
scalarDictExamMap.set(modelName, scalarDictExam);
|
|
287
|
-
});
|
|
288
|
-
scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
289
|
-
const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
|
|
290
|
-
scalarDictExam.sigRefs.push(sigRef);
|
|
291
|
-
scalarDictExamMap.set(modelName, scalarDictExam);
|
|
292
|
-
});
|
|
293
|
-
const getDefaultSignalDict = () => ({ sigRefs: [] });
|
|
294
|
-
pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
295
|
-
const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
|
|
296
|
-
signalDictExam.sigRefs.push(sigRef);
|
|
297
|
-
signalDictExamMap.set(modelName, signalDictExam);
|
|
298
|
-
});
|
|
299
|
-
modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
|
|
300
|
-
const dictionary = rootDictionary[modelName];
|
|
301
|
-
if (!dictionary)
|
|
302
|
-
return;
|
|
303
|
-
checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
|
|
304
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
305
|
-
checkFilterDictCoverages(modelName, filterRefs, dictionary);
|
|
306
|
-
});
|
|
307
|
-
scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
|
|
308
|
-
const dictionary = rootDictionary[modelName];
|
|
309
|
-
if (!dictionary)
|
|
310
|
-
return;
|
|
311
|
-
checkModelDictCoverages(modelName, dictionary, modelRefs, []);
|
|
312
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
313
|
-
});
|
|
314
|
-
signalDictExamMap.forEach(({ sigRefs }, modelName) => {
|
|
315
|
-
const dictionary = rootDictionary[modelName];
|
|
316
|
-
if (!dictionary)
|
|
317
|
-
return;
|
|
318
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
100
|
const rootDictionary = {};
|
|
322
101
|
const makeDictionary = (...dicts) => {
|
|
323
102
|
const [rootDict, ...additionalDicts] = dicts;
|
|
@@ -367,5 +146,8 @@ const makeTrans = (locale) => {
|
|
|
367
146
|
});
|
|
368
147
|
return dictionary;
|
|
369
148
|
};
|
|
370
|
-
|
|
149
|
+
const getAllDictionary = () => {
|
|
150
|
+
return Object.fromEntries(languages.map((lang) => [lang, getDictionary(lang)]));
|
|
151
|
+
};
|
|
152
|
+
return { revert, Revert, translate, msg, getDictionary, getAllDictionary };
|
|
371
153
|
};
|
|
@@ -34,9 +34,13 @@ const baseDictionary = {
|
|
|
34
34
|
"apidesc-getDictionary": ["Get Dictionary", "Get Dictionary"],
|
|
35
35
|
"arg-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
|
|
36
36
|
"argdesc-getDictionary-lang": ["Language", "\uC5B8\uC5B4"],
|
|
37
|
+
"api-getAllDictionary": ["Get All Dictionary", "Get All Dictionary"],
|
|
38
|
+
"apidesc-getAllDictionary": ["Get All Dictionary", "Get All Dictionary"],
|
|
39
|
+
"api-getSignals": ["Get Signals", "Get Signals"],
|
|
40
|
+
"apidesc-getSignals": ["Get Signals", "Get Signals"],
|
|
37
41
|
// * ==================== Endpoint ==================== * //
|
|
38
42
|
// * ==================== Etc ==================== * //
|
|
39
|
-
new: ["New", "
|
|
43
|
+
// new: ["New", "신규"],
|
|
40
44
|
somethingWrong: ["Something's wrong!", "\uBB38\uC81C\uAC00 \uC0DD\uACBC\uC5B4\uC694!"],
|
|
41
45
|
connecting: ["Connecting...", "\uC5F0\uACB0 \uC911..."],
|
|
42
46
|
connected: ["Connected!", "\uC5F0\uACB0\uB418\uC5C8\uC2B5\uB2C8\uB2E4!"],
|
|
@@ -46,7 +50,56 @@ const baseDictionary = {
|
|
|
46
50
|
serverHasProblem: ["Maybe your server is having a problem.", "\uC11C\uBC84\uC5D0 \uBB38\uC81C\uAC00 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."],
|
|
47
51
|
checkServerStatus: ["Please check your server status.", "\uC11C\uBC84 \uC0C1\uD0DC\uB97C \uD655\uC778\uD574\uC8FC\uC138\uC694."],
|
|
48
52
|
success: ["Success", "\uC131\uACF5"],
|
|
49
|
-
failed: ["Failed", "\uC2E4\uD328"]
|
|
53
|
+
failed: ["Failed", "\uC2E4\uD328"],
|
|
54
|
+
processing: ["Processing...", "\uCC98\uB9AC\uC911..."],
|
|
55
|
+
processed: ["Processed", "\uCC98\uB9AC \uC644\uB8CC"],
|
|
56
|
+
noData: ["Empty", "\uBE44\uC5B4\uC788\uC74C"],
|
|
57
|
+
error: ["Error", "\uC624\uB958"],
|
|
58
|
+
invalidValueError: ["Value is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4."],
|
|
59
|
+
emailInvalidError: ["Email is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4."],
|
|
60
|
+
phoneInvalidError: ["Phone is not valid", "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC804\uD654\uBC88\uD638\uC785\uB2C8\uB2E4."],
|
|
61
|
+
ok: ["OK", "\uD655\uC778"],
|
|
62
|
+
cancel: ["Cancel", "\uCDE8\uC18C"],
|
|
63
|
+
unauthorized: ["Unauthorized", "\uAD8C\uD55C \uC5C6\uC74C"],
|
|
64
|
+
confirmClose: ["Are you sure you want to close the modal?", "\uBAA8\uB2EC\uC744 \uB2EB\uC73C\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?"],
|
|
65
|
+
textTooShortError: ["More than {minlength} characters needed.", "{minlength}\uC790 \uC774\uC0C1 \uD544\uC694\uD569\uB2C8\uB2E4."],
|
|
66
|
+
textTooLongError: ["Less than {maxlength} characters needed.", "{maxlength}\uC790 \uC774\uD558\uB85C \uD544\uC694\uD569\uB2C8\uB2E4."],
|
|
67
|
+
selectTooShortError: ["Select at least {minlength} item(s)", "{minlength}\uAC1C \uC774\uC0C1 \uC120\uD0DD\uD574\uC57C\uD569\uB2C8\uB2E4."],
|
|
68
|
+
selectTooLongError: ["Select at most {maxlength} item(s)", "{maxlength}\uAC1C \uC774\uD558\uB85C \uC120\uD0DD\uD574\uC57C\uD569\uB2C8\uB2E4."],
|
|
69
|
+
numberTooSmallError: ["Value must be greater than {min}", "{min}\uBCF4\uB2E4 \uCEE4\uC57C\uD569\uB2C8\uB2E4."],
|
|
70
|
+
numberTooBigError: ["Value must be less than {max}", "{max}\uBCF4\uB2E4 \uC791\uC544\uC57C\uD569\uB2C8\uB2E4."],
|
|
71
|
+
passwordNotMatchError: ["Password does not match", "\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."],
|
|
72
|
+
selectDateError: ["Please select a date.", "\uB0A0\uC9DC\uB97C \uC120\uD0DD\uD574\uC8FC\uC138\uC694."],
|
|
73
|
+
priceUnit: ["$", "\uC6D0"],
|
|
74
|
+
password: ["Password", "\uBE44\uBC00\uBC88\uD638"],
|
|
75
|
+
passwordConfirm: ["Password Confirm", "\uBE44\uBC00\uBC88\uD638 \uD655\uC778"],
|
|
76
|
+
noOptions: ["Can't find any datas", "\uB370\uC774\uD130\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."],
|
|
77
|
+
addModel: ["Add {model}", "{model} \uCD94\uAC00"],
|
|
78
|
+
createModel: ["Create {model}", "{model} \uC0DD\uC131\uD558\uAE30"],
|
|
79
|
+
createSuccess: ["{model} create success", "{model} \uC0DD\uC131 \uC644\uB8CC"],
|
|
80
|
+
updateModel: ["Update {model}", "{model} \uC218\uC815\uD558\uAE30"],
|
|
81
|
+
removeModel: ["Remove {model}", "{model} \uC0AD\uC81C\uD558\uAE30"],
|
|
82
|
+
updateSuccess: ["{model} update success", "{model} \uC218\uC815 \uC644\uB8CC"],
|
|
83
|
+
removeSuccess: ["{model} removed", "{model} \uC0AD\uC81C \uC644\uB8CC"],
|
|
84
|
+
sureToRemove: [`Are you sure to delete {model} {name}?`, `\uC815\uB9D0\uB85C {name} {model}\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`],
|
|
85
|
+
irreversibleOps: [
|
|
86
|
+
`This operation is irreversible, and all data cannot be backed up.`,
|
|
87
|
+
`\uC774 \uC791\uC5C5\uC740 \uB418\uB3CC\uB9B4 \uC218 \uC5C6\uC73C\uBA70, \uBAA8\uB4E0 \uB370\uC774\uD130\uB294 \uBC31\uC5C5\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`
|
|
88
|
+
],
|
|
89
|
+
typeNameToRemove: [
|
|
90
|
+
`If you want to delete this {model}, please enter the name ({name}) of the {model} to confirm.`,
|
|
91
|
+
`{model} \uC0AD\uC81C\uB97C \uC6D0\uD558\uB294 \uACBD\uC6B0, {name} \uC774\uB984\uC744 \uC785\uB825\uD558\uC138\uC694.`
|
|
92
|
+
],
|
|
93
|
+
yesRemove: ["Yes, remove this {model}", "\uB124, {model} \uC0AD\uC81C\uB97C \uC9C4\uD589\uD569\uB2C8\uB2E4."],
|
|
94
|
+
removeMsg: ["Are you sure to remove?", "\uC815\uB9D0\uB85C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?"],
|
|
95
|
+
confirmMsg: ["Are you sure to {actionType}", "\uC9C4\uD589\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C? ({actionType})"],
|
|
96
|
+
perPage: ["/page", "/\uD398\uC774\uC9C0"],
|
|
97
|
+
actions: ["Actions", "\uC791\uC5C5"],
|
|
98
|
+
new: ["New", "\uC2E0\uADDC"],
|
|
99
|
+
edit: ["Edit", "\uC218\uC815"],
|
|
100
|
+
save: ["Save", "\uC800\uC7A5"],
|
|
101
|
+
remove: ["Remove", "\uC0AD\uC81C"],
|
|
102
|
+
view: ["View", "\uBCF4\uAE30"]
|
|
50
103
|
// * ==================== Etc ==================== * //
|
|
51
104
|
};
|
|
52
105
|
export {
|
package/esm/src/dictionary.js
CHANGED
|
@@ -3,10 +3,11 @@ import { makeTrans } from "./trans";
|
|
|
3
3
|
const dictionary = {
|
|
4
4
|
base: baseDictionary
|
|
5
5
|
};
|
|
6
|
-
const { Revert, translate, msg, getDictionary } = makeTrans(dictionary);
|
|
6
|
+
const { Revert, translate, msg, getDictionary, getAllDictionary } = makeTrans(dictionary);
|
|
7
7
|
export {
|
|
8
8
|
Revert,
|
|
9
9
|
dictionary,
|
|
10
|
+
getAllDictionary,
|
|
10
11
|
getDictionary,
|
|
11
12
|
msg,
|
|
12
13
|
translate
|
package/esm/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from "./trans";
|
|
2
|
-
import { Revert, translate, dictionary, getDictionary } from "./dictionary";
|
|
3
|
-
|
|
2
|
+
import { Revert, translate, dictionary, getDictionary, getAllDictionary } from "./dictionary";
|
|
3
|
+
export * from "./serverTranslator";
|
|
4
4
|
export {
|
|
5
5
|
Revert,
|
|
6
6
|
dictionary,
|
|
7
|
+
getAllDictionary,
|
|
7
8
|
getDictionary,
|
|
8
|
-
serverTranslator,
|
|
9
9
|
translate
|
|
10
10
|
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
+
import { baseClientEnv } from "@akanjs/base";
|
|
1
2
|
import { Logger } from "@akanjs/common";
|
|
2
|
-
import { fetch } from "@akanjs/signal";
|
|
3
3
|
class ServerTranslator {
|
|
4
4
|
static #langTransMap = /* @__PURE__ */ new Map();
|
|
5
5
|
async init(lang) {
|
|
6
|
-
await this.#getTranslator(lang);
|
|
6
|
+
const { dictionary } = await this.#getTranslator(lang);
|
|
7
|
+
return { lang: dictionary };
|
|
8
|
+
}
|
|
9
|
+
async initAllLanguages(existingAllDictionary) {
|
|
10
|
+
const allDictionary = existingAllDictionary ?? await (await fetch(`${baseClientEnv.serverHttpUri}/getAllDictionary`)).json();
|
|
11
|
+
Object.entries(allDictionary).forEach(([lang, dictionary]) => {
|
|
12
|
+
this.setTranslator(lang, dictionary);
|
|
13
|
+
});
|
|
14
|
+
return allDictionary;
|
|
7
15
|
}
|
|
8
16
|
async #getTranslator(lang) {
|
|
9
17
|
const existingTrans = ServerTranslator.#langTransMap.get(lang);
|
|
10
18
|
if (existingTrans)
|
|
11
19
|
return existingTrans;
|
|
12
20
|
Logger.log("Initialize ServerTranslator");
|
|
13
|
-
const dictionary = await fetch.getDictionary
|
|
21
|
+
const dictionary = await (await fetch(`${baseClientEnv.serverHttpUri}/getDictionary/${lang}`)).json();
|
|
14
22
|
return this.setTranslator(lang, dictionary);
|
|
15
23
|
}
|
|
16
24
|
hasTranslator(lang) {
|
package/esm/src/trans.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import { capitalize
|
|
2
|
-
import {
|
|
3
|
-
getAllFilterModelRefs,
|
|
4
|
-
getAllFullModelRefs,
|
|
5
|
-
getAllScalarModelRefs,
|
|
6
|
-
getClassMeta,
|
|
7
|
-
getFieldMetaMap,
|
|
8
|
-
getFilterArgMetas,
|
|
9
|
-
getFilterMeta,
|
|
10
|
-
getFilterQueryMap,
|
|
11
|
-
getFilterSortMap
|
|
12
|
-
} from "@akanjs/constant";
|
|
13
|
-
import { getAllSignalRefs, getArgMetas, getGqlMetas, getSigMeta } from "@akanjs/signal";
|
|
1
|
+
import { capitalize } from "@akanjs/common";
|
|
14
2
|
const baseTrans = {
|
|
15
3
|
id: ["Id", "\uC544\uC774\uB514"],
|
|
16
4
|
"desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
|
|
@@ -82,224 +70,6 @@ const getBaseSignalTrans = (modelName) => {
|
|
|
82
70
|
// * ==================== Endpoint ==================== * //
|
|
83
71
|
};
|
|
84
72
|
};
|
|
85
|
-
const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
|
|
86
|
-
const enumKeyMap = /* @__PURE__ */ new Map();
|
|
87
|
-
modelRefs.forEach((modelRef) => {
|
|
88
|
-
const fieldMetaMap = getFieldMetaMap(modelRef);
|
|
89
|
-
[...fieldMetaMap.values()].forEach((fieldMeta) => {
|
|
90
|
-
if (!fieldMeta.enum)
|
|
91
|
-
return;
|
|
92
|
-
enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
|
|
93
|
-
fieldMeta.enum.forEach((value) => {
|
|
94
|
-
const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
|
|
95
|
-
const modelDict = rootDictionary[modelName];
|
|
96
|
-
const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
|
|
97
|
-
if (!enumDict && !rootEnumDict) {
|
|
98
|
-
Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
|
|
99
|
-
}
|
|
100
|
-
const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
|
|
101
|
-
const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
|
|
102
|
-
if (!enumDescDict && !rootEnumDescDict) {
|
|
103
|
-
Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
|
|
109
|
-
const [, fieldKey, ...values] = key.split("-");
|
|
110
|
-
const value = values.join("-");
|
|
111
|
-
if (!enumKeyMap.get(fieldKey)?.has(value)) {
|
|
112
|
-
Logger.error(
|
|
113
|
-
`\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const fieldKeySet = /* @__PURE__ */ new Set([
|
|
118
|
-
...modelRefs.map((modelRef) => [...getFieldMetaMap(modelRef).keys()]).flat(),
|
|
119
|
-
...filterRefs.map((filterRef) => Object.keys(getFilterSortMap(filterRef))).flat()
|
|
120
|
-
]);
|
|
121
|
-
Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
|
|
122
|
-
const [, fieldKey] = key.split("-");
|
|
123
|
-
if (!fieldKeySet.has(fieldKey))
|
|
124
|
-
Logger.error(
|
|
125
|
-
`\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
|
|
130
|
-
const argKeyMap = /* @__PURE__ */ new Map();
|
|
131
|
-
sigRefs.forEach((sigRef) => {
|
|
132
|
-
const gqlMetas = getGqlMetas(sigRef);
|
|
133
|
-
gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
|
|
134
|
-
const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
|
|
135
|
-
argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
|
|
136
|
-
argMetas.forEach((argMeta) => {
|
|
137
|
-
const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
|
|
138
|
-
if (!argDict) {
|
|
139
|
-
Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
|
|
140
|
-
}
|
|
141
|
-
const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
|
|
142
|
-
if (!argDescDict) {
|
|
143
|
-
Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
|
|
149
|
-
const [, gqlKey, argKey] = key.split("-");
|
|
150
|
-
if (!argKeyMap.get(gqlKey)?.has(argKey))
|
|
151
|
-
Logger.error(
|
|
152
|
-
`\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
|
|
153
|
-
);
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
const checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
|
|
157
|
-
const qargKeyMap = /* @__PURE__ */ new Map();
|
|
158
|
-
filterRefs.forEach((filterRef) => {
|
|
159
|
-
const filterMetaMap = getFilterQueryMap(filterRef);
|
|
160
|
-
filterMetaMap.forEach((filterMeta) => {
|
|
161
|
-
const filterArgMetas = getFilterArgMetas(filterRef, filterMeta.key);
|
|
162
|
-
qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
|
|
163
|
-
filterArgMetas.forEach((filterArgMeta) => {
|
|
164
|
-
const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
|
|
165
|
-
if (!qargDict)
|
|
166
|
-
Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
|
|
167
|
-
const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
|
|
168
|
-
if (!qargDescDict)
|
|
169
|
-
Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
|
|
174
|
-
const [, filterKey, filterArgKey] = key.split("-");
|
|
175
|
-
if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
|
|
176
|
-
Logger.error(
|
|
177
|
-
`\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
|
|
178
|
-
);
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
const checkDictCoverage = () => {
|
|
182
|
-
const fullModelRefEntries = getAllFullModelRefs().filter((modelRef) => {
|
|
183
|
-
const classMeta = getClassMeta(modelRef);
|
|
184
|
-
return classMeta.type === "full" && classMeta.modelType === "data";
|
|
185
|
-
}).map((modelRef) => {
|
|
186
|
-
const classMeta = getClassMeta(modelRef);
|
|
187
|
-
const modelName = lowerlize(classMeta.refName);
|
|
188
|
-
return { modelName, modelRef };
|
|
189
|
-
});
|
|
190
|
-
const scalarModelRefs = getAllScalarModelRefs();
|
|
191
|
-
const insightModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "insight").map((modelRef) => {
|
|
192
|
-
const classMeta = getClassMeta(modelRef);
|
|
193
|
-
if (!classMeta.refName.endsWith("Insight"))
|
|
194
|
-
throw new Error(`Invalid insight model name: ${classMeta.refName}`);
|
|
195
|
-
const modelName = lowerlize(classMeta.refName.slice(0, -7));
|
|
196
|
-
return { modelName, modelRef };
|
|
197
|
-
});
|
|
198
|
-
const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "data").map((modelRef) => {
|
|
199
|
-
const classMeta = getClassMeta(modelRef);
|
|
200
|
-
const modelName = lowerlize(classMeta.refName);
|
|
201
|
-
return { modelName, modelRef };
|
|
202
|
-
});
|
|
203
|
-
const filterModelRefEntries = getAllFilterModelRefs().map((filterModelRef) => {
|
|
204
|
-
const filterMeta = getFilterMeta(filterModelRef);
|
|
205
|
-
if (!filterMeta.refName.endsWith("Filter"))
|
|
206
|
-
throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
|
|
207
|
-
const modelName = lowerlize(filterMeta.refName.slice(0, -6));
|
|
208
|
-
return { modelName, filterModelRef };
|
|
209
|
-
});
|
|
210
|
-
const signalRefs = getAllSignalRefs();
|
|
211
|
-
const fullModelSignalRefEntries = signalRefs.filter((ref) => {
|
|
212
|
-
const sigMeta = getSigMeta(ref);
|
|
213
|
-
if (!sigMeta.returns)
|
|
214
|
-
return false;
|
|
215
|
-
const modelRef = sigMeta.returns();
|
|
216
|
-
const classMeta = getClassMeta(modelRef);
|
|
217
|
-
return classMeta.type === "full";
|
|
218
|
-
}).map((sigRef) => {
|
|
219
|
-
const sigMeta = getSigMeta(sigRef);
|
|
220
|
-
const modelName = lowerlize(sigMeta.refName);
|
|
221
|
-
return { modelName, sigRef };
|
|
222
|
-
});
|
|
223
|
-
const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
|
|
224
|
-
const sigMeta = getSigMeta(ref);
|
|
225
|
-
if (!sigMeta.returns)
|
|
226
|
-
return false;
|
|
227
|
-
const modelRef = sigMeta.returns();
|
|
228
|
-
const classMeta = getClassMeta(modelRef);
|
|
229
|
-
return classMeta.type === "scalar";
|
|
230
|
-
}).map((sigRef) => {
|
|
231
|
-
const sigMeta = getSigMeta(sigRef);
|
|
232
|
-
const modelName = lowerlize(sigMeta.refName);
|
|
233
|
-
return { modelName, sigRef };
|
|
234
|
-
});
|
|
235
|
-
const pureSignalRefEntries = signalRefs.filter((ref) => !getSigMeta(ref).returns).map((sigRef) => {
|
|
236
|
-
const sigMeta = getSigMeta(sigRef);
|
|
237
|
-
const modelName = lowerlize(sigMeta.refName);
|
|
238
|
-
return { modelName, sigRef };
|
|
239
|
-
});
|
|
240
|
-
const modelDictExamMap = /* @__PURE__ */ new Map();
|
|
241
|
-
const scalarDictExamMap = /* @__PURE__ */ new Map();
|
|
242
|
-
const signalDictExamMap = /* @__PURE__ */ new Map();
|
|
243
|
-
const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
|
|
244
|
-
fullModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
245
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
246
|
-
modelDictExam.modelRefs.push(modelRef);
|
|
247
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
248
|
-
});
|
|
249
|
-
insightModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
250
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
251
|
-
modelDictExam.insightRefs.push(modelRef);
|
|
252
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
253
|
-
});
|
|
254
|
-
fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
255
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
256
|
-
modelDictExam.sigRefs.push(sigRef);
|
|
257
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
258
|
-
});
|
|
259
|
-
filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
|
|
260
|
-
const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
|
|
261
|
-
modelDictExam.filterRefs.push(filterModelRef);
|
|
262
|
-
modelDictExamMap.set(modelName, modelDictExam);
|
|
263
|
-
});
|
|
264
|
-
const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
|
|
265
|
-
pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
|
|
266
|
-
const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
|
|
267
|
-
scalarDictExam.modelRefs.push(modelRef);
|
|
268
|
-
scalarDictExamMap.set(modelName, scalarDictExam);
|
|
269
|
-
});
|
|
270
|
-
scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
271
|
-
const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
|
|
272
|
-
scalarDictExam.sigRefs.push(sigRef);
|
|
273
|
-
scalarDictExamMap.set(modelName, scalarDictExam);
|
|
274
|
-
});
|
|
275
|
-
const getDefaultSignalDict = () => ({ sigRefs: [] });
|
|
276
|
-
pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
|
|
277
|
-
const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
|
|
278
|
-
signalDictExam.sigRefs.push(sigRef);
|
|
279
|
-
signalDictExamMap.set(modelName, signalDictExam);
|
|
280
|
-
});
|
|
281
|
-
modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
|
|
282
|
-
const dictionary = rootDictionary[modelName];
|
|
283
|
-
if (!dictionary)
|
|
284
|
-
return;
|
|
285
|
-
checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
|
|
286
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
287
|
-
checkFilterDictCoverages(modelName, filterRefs, dictionary);
|
|
288
|
-
});
|
|
289
|
-
scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
|
|
290
|
-
const dictionary = rootDictionary[modelName];
|
|
291
|
-
if (!dictionary)
|
|
292
|
-
return;
|
|
293
|
-
checkModelDictCoverages(modelName, dictionary, modelRefs, []);
|
|
294
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
295
|
-
});
|
|
296
|
-
signalDictExamMap.forEach(({ sigRefs }, modelName) => {
|
|
297
|
-
const dictionary = rootDictionary[modelName];
|
|
298
|
-
if (!dictionary)
|
|
299
|
-
return;
|
|
300
|
-
checkSignalDictCoverages(modelName, sigRefs, dictionary);
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
73
|
const rootDictionary = {};
|
|
304
74
|
const makeDictionary = (...dicts) => {
|
|
305
75
|
const [rootDict, ...additionalDicts] = dicts;
|
|
@@ -349,11 +119,13 @@ const makeTrans = (locale) => {
|
|
|
349
119
|
});
|
|
350
120
|
return dictionary;
|
|
351
121
|
};
|
|
352
|
-
|
|
122
|
+
const getAllDictionary = () => {
|
|
123
|
+
return Object.fromEntries(languages.map((lang) => [lang, getDictionary(lang)]));
|
|
124
|
+
};
|
|
125
|
+
return { revert, Revert, translate, msg, getDictionary, getAllDictionary };
|
|
353
126
|
};
|
|
354
127
|
export {
|
|
355
128
|
baseTrans,
|
|
356
|
-
checkDictCoverage,
|
|
357
129
|
getBaseSignalTrans,
|
|
358
130
|
makeDictionary,
|
|
359
131
|
makeTrans,
|
package/package.json
CHANGED
package/src/base.dictionary.d.ts
CHANGED
|
@@ -33,7 +33,10 @@ export declare const baseDictionary: {
|
|
|
33
33
|
"apidesc-getDictionary": [string, string];
|
|
34
34
|
"arg-getDictionary-lang": [string, string];
|
|
35
35
|
"argdesc-getDictionary-lang": [string, string];
|
|
36
|
-
|
|
36
|
+
"api-getAllDictionary": [string, string];
|
|
37
|
+
"apidesc-getAllDictionary": [string, string];
|
|
38
|
+
"api-getSignals": [string, string];
|
|
39
|
+
"apidesc-getSignals": [string, string];
|
|
37
40
|
somethingWrong: [string, string];
|
|
38
41
|
connecting: [string, string];
|
|
39
42
|
connected: [string, string];
|
|
@@ -44,4 +47,47 @@ export declare const baseDictionary: {
|
|
|
44
47
|
checkServerStatus: [string, string];
|
|
45
48
|
success: [string, string];
|
|
46
49
|
failed: [string, string];
|
|
50
|
+
processing: [string, string];
|
|
51
|
+
processed: [string, string];
|
|
52
|
+
noData: [string, string];
|
|
53
|
+
error: [string, string];
|
|
54
|
+
invalidValueError: [string, string];
|
|
55
|
+
emailInvalidError: [string, string];
|
|
56
|
+
phoneInvalidError: [string, string];
|
|
57
|
+
ok: [string, string];
|
|
58
|
+
cancel: [string, string];
|
|
59
|
+
unauthorized: [string, string];
|
|
60
|
+
confirmClose: [string, string];
|
|
61
|
+
textTooShortError: [string, string];
|
|
62
|
+
textTooLongError: [string, string];
|
|
63
|
+
selectTooShortError: [string, string];
|
|
64
|
+
selectTooLongError: [string, string];
|
|
65
|
+
numberTooSmallError: [string, string];
|
|
66
|
+
numberTooBigError: [string, string];
|
|
67
|
+
passwordNotMatchError: [string, string];
|
|
68
|
+
selectDateError: [string, string];
|
|
69
|
+
priceUnit: [string, string];
|
|
70
|
+
password: [string, string];
|
|
71
|
+
passwordConfirm: [string, string];
|
|
72
|
+
noOptions: [string, string];
|
|
73
|
+
addModel: [string, string];
|
|
74
|
+
createModel: [string, string];
|
|
75
|
+
createSuccess: [string, string];
|
|
76
|
+
updateModel: [string, string];
|
|
77
|
+
removeModel: [string, string];
|
|
78
|
+
updateSuccess: [string, string];
|
|
79
|
+
removeSuccess: [string, string];
|
|
80
|
+
sureToRemove: [string, string];
|
|
81
|
+
irreversibleOps: [string, string];
|
|
82
|
+
typeNameToRemove: [string, string];
|
|
83
|
+
yesRemove: [string, string];
|
|
84
|
+
removeMsg: [string, string];
|
|
85
|
+
confirmMsg: [string, string];
|
|
86
|
+
perPage: [string, string];
|
|
87
|
+
actions: [string, string];
|
|
88
|
+
new: [string, string];
|
|
89
|
+
edit: [string, string];
|
|
90
|
+
save: [string, string];
|
|
91
|
+
remove: [string, string];
|
|
92
|
+
view: [string, string];
|
|
47
93
|
};
|
package/src/dictionary.d.ts
CHANGED
|
@@ -34,7 +34,10 @@ export declare const dictionary: {
|
|
|
34
34
|
"apidesc-getDictionary": [string, string];
|
|
35
35
|
"arg-getDictionary-lang": [string, string];
|
|
36
36
|
"argdesc-getDictionary-lang": [string, string];
|
|
37
|
-
|
|
37
|
+
"api-getAllDictionary": [string, string];
|
|
38
|
+
"apidesc-getAllDictionary": [string, string];
|
|
39
|
+
"api-getSignals": [string, string];
|
|
40
|
+
"apidesc-getSignals": [string, string];
|
|
38
41
|
somethingWrong: [string, string];
|
|
39
42
|
connecting: [string, string];
|
|
40
43
|
connected: [string, string];
|
|
@@ -45,21 +48,70 @@ export declare const dictionary: {
|
|
|
45
48
|
checkServerStatus: [string, string];
|
|
46
49
|
success: [string, string];
|
|
47
50
|
failed: [string, string];
|
|
51
|
+
processing: [string, string];
|
|
52
|
+
processed: [string, string];
|
|
53
|
+
noData: [string, string];
|
|
54
|
+
error: [string, string];
|
|
55
|
+
invalidValueError: [string, string];
|
|
56
|
+
emailInvalidError: [string, string];
|
|
57
|
+
phoneInvalidError: [string, string];
|
|
58
|
+
ok: [string, string];
|
|
59
|
+
cancel: [string, string];
|
|
60
|
+
unauthorized: [string, string];
|
|
61
|
+
confirmClose: [string, string];
|
|
62
|
+
textTooShortError: [string, string];
|
|
63
|
+
textTooLongError: [string, string];
|
|
64
|
+
selectTooShortError: [string, string];
|
|
65
|
+
selectTooLongError: [string, string];
|
|
66
|
+
numberTooSmallError: [string, string];
|
|
67
|
+
numberTooBigError: [string, string];
|
|
68
|
+
passwordNotMatchError: [string, string];
|
|
69
|
+
selectDateError: [string, string];
|
|
70
|
+
priceUnit: [string, string];
|
|
71
|
+
password: [string, string];
|
|
72
|
+
passwordConfirm: [string, string];
|
|
73
|
+
noOptions: [string, string];
|
|
74
|
+
addModel: [string, string];
|
|
75
|
+
createModel: [string, string];
|
|
76
|
+
createSuccess: [string, string];
|
|
77
|
+
updateModel: [string, string];
|
|
78
|
+
removeModel: [string, string];
|
|
79
|
+
updateSuccess: [string, string];
|
|
80
|
+
removeSuccess: [string, string];
|
|
81
|
+
sureToRemove: [string, string];
|
|
82
|
+
irreversibleOps: [string, string];
|
|
83
|
+
typeNameToRemove: [string, string];
|
|
84
|
+
yesRemove: [string, string];
|
|
85
|
+
removeMsg: [string, string];
|
|
86
|
+
confirmMsg: [string, string];
|
|
87
|
+
perPage: [string, string];
|
|
88
|
+
actions: [string, string];
|
|
89
|
+
new: [string, string];
|
|
90
|
+
edit: [string, string];
|
|
91
|
+
save: [string, string];
|
|
92
|
+
remove: [string, string];
|
|
93
|
+
view: [string, string];
|
|
48
94
|
};
|
|
49
95
|
};
|
|
50
96
|
export declare const Revert: {
|
|
51
|
-
new (key: "base.
|
|
97
|
+
new (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", data?: any): Error;
|
|
52
98
|
prototype: Error;
|
|
53
|
-
}, translate: (lang: "en" | "ko" | "zhChs" | "zhCht", key: "base.
|
|
99
|
+
}, translate: (lang: "en" | "ko" | "zhChs" | "zhCht", key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", data?: {
|
|
54
100
|
[key: string]: any;
|
|
55
101
|
}) => string, msg: {
|
|
56
|
-
info: (key: "base.
|
|
57
|
-
success: (key: "base.
|
|
58
|
-
error: (key: "base.
|
|
59
|
-
warning: (key: "base.
|
|
60
|
-
loading: (key: "base.
|
|
102
|
+
info: (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", option?: import("./trans").TransMessageOption) => void;
|
|
103
|
+
success: (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", option?: import("./trans").TransMessageOption) => void;
|
|
104
|
+
error: (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", option?: import("./trans").TransMessageOption) => void;
|
|
105
|
+
warning: (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", option?: import("./trans").TransMessageOption) => void;
|
|
106
|
+
loading: (key: "base.error" | "base.password" | "base.save" | "base.remove" | "base.ok" | "base.new" | "base.apidesc-ping" | "base.api-ping" | "base.apidesc-pingBody" | "base.api-pingBody" | "base.apidesc-pingParam" | "base.api-pingParam" | "base.apidesc-pingQuery" | "base.api-pingQuery" | "base.apidesc-pingEvery" | "base.api-pingEvery" | "base.apidesc-pingUser" | "base.api-pingUser" | "base.apidesc-pingAdmin" | "base.api-pingAdmin" | "base.apidesc-getDictionary" | "base.api-getDictionary" | "base.apidesc-getAllDictionary" | "base.api-getAllDictionary" | "base.apidesc-cleanup" | "base.api-cleanup" | "base.apidesc-wsPing" | "base.api-wsPing" | "base.apidesc-pubsubPing" | "base.api-pubsubPing" | "base.apidesc-getSignals" | "base.api-getSignals" | "base.api-publishPing" | "base.apidesc-publishPing" | "base.arg-pingBody-data" | "base.argdesc-pingBody-data" | "base.arg-pingParam-id" | "base.argdesc-pingParam-id" | "base.arg-pingQuery-id" | "base.argdesc-pingQuery-id" | "base.arg-wsPing-data" | "base.argdesc-wsPing-data" | "base.arg-getDictionary-lang" | "base.argdesc-getDictionary-lang" | "base.somethingWrong" | "base.connecting" | "base.connected" | "base.serverDisconnected" | "base.refreshing" | "base.tryReconnecting" | "base.serverHasProblem" | "base.checkServerStatus" | "base.success" | "base.failed" | "base.processing" | "base.processed" | "base.noData" | "base.invalidValueError" | "base.emailInvalidError" | "base.phoneInvalidError" | "base.cancel" | "base.unauthorized" | "base.confirmClose" | "base.textTooShortError" | "base.textTooLongError" | "base.selectTooShortError" | "base.selectTooLongError" | "base.numberTooSmallError" | "base.numberTooBigError" | "base.passwordNotMatchError" | "base.selectDateError" | "base.priceUnit" | "base.passwordConfirm" | "base.noOptions" | "base.addModel" | "base.createModel" | "base.createSuccess" | "base.updateModel" | "base.removeModel" | "base.updateSuccess" | "base.removeSuccess" | "base.sureToRemove" | "base.irreversibleOps" | "base.typeNameToRemove" | "base.yesRemove" | "base.removeMsg" | "base.confirmMsg" | "base.perPage" | "base.actions" | "base.edit" | "base.view", option?: import("./trans").TransMessageOption) => void;
|
|
61
107
|
}, getDictionary: (lang: "en" | "ko" | "zhChs" | "zhCht") => {
|
|
62
108
|
[key: string]: {
|
|
63
109
|
[key: string]: string;
|
|
64
110
|
};
|
|
111
|
+
}, getAllDictionary: () => {
|
|
112
|
+
[key: string]: {
|
|
113
|
+
[key: string]: {
|
|
114
|
+
[key: string]: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
65
117
|
};
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./trans";
|
|
2
|
-
export { Revert, translate, dictionary, getDictionary } from "./dictionary";
|
|
3
|
-
export
|
|
2
|
+
export { Revert, translate, dictionary, getDictionary, getAllDictionary } from "./dictionary";
|
|
3
|
+
export * from "./serverTranslator";
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
export interface Dictionary {
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export interface AllDictionary {
|
|
7
|
+
[key: string]: Dictionary;
|
|
8
|
+
}
|
|
1
9
|
export declare class ServerTranslator {
|
|
2
10
|
#private;
|
|
3
|
-
init(lang: string): Promise<
|
|
11
|
+
init(lang: string): Promise<AllDictionary>;
|
|
12
|
+
initAllLanguages(existingAllDictionary?: AllDictionary): Promise<AllDictionary>;
|
|
4
13
|
hasTranslator(lang: string): boolean;
|
|
5
|
-
setTranslator(lang: string, dictionary:
|
|
6
|
-
dictionary:
|
|
14
|
+
setTranslator(lang: string, dictionary: Dictionary): {
|
|
15
|
+
dictionary: Dictionary;
|
|
7
16
|
translate: (dictKey: `${string}.${string}`) => string;
|
|
8
17
|
};
|
|
9
18
|
getTransSync(lang: string, key: string, param?: Record<string, string | number>): string | undefined;
|
|
10
19
|
getTrans(lang: string, key: string, param?: Record<string, string | number>): Promise<string>;
|
|
11
|
-
getDictionary(lang: string): Promise<
|
|
20
|
+
getDictionary(lang: string): Promise<Dictionary>;
|
|
12
21
|
}
|
|
13
22
|
export declare const serverTranslator: ServerTranslator;
|
package/src/trans.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GetActionObject, GetStateObject } from "@akanjs/base";
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseFilterKey } from "@akanjs/document";
|
|
3
3
|
import { DefaultSignal } from "@akanjs/signal";
|
|
4
4
|
type TranslationSingle = readonly [string, string] | readonly [string, string, string, string];
|
|
5
5
|
type TranslationWithParam = readonly [string, string, {
|
|
@@ -58,7 +58,6 @@ type BaseSignalTrans<T extends string> = {
|
|
|
58
58
|
[K in keyof DefaultSignal<T, any, any, any, any, any> as K extends string ? `apidesc-${K}` | `api-${K}` : never]: Translation;
|
|
59
59
|
};
|
|
60
60
|
export declare const getBaseSignalTrans: <T extends string>(modelName: T) => BaseSignalTrans<T>;
|
|
61
|
-
export declare const checkDictCoverage: () => void;
|
|
62
61
|
interface DictType {
|
|
63
62
|
[key: string]: {
|
|
64
63
|
[key: string]: Translation;
|
|
@@ -112,5 +111,12 @@ export declare const makeTrans: <Locale extends {
|
|
|
112
111
|
[key: string]: string;
|
|
113
112
|
};
|
|
114
113
|
};
|
|
114
|
+
getAllDictionary: () => {
|
|
115
|
+
[key: string]: {
|
|
116
|
+
[key: string]: {
|
|
117
|
+
[key: string]: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
115
121
|
};
|
|
116
122
|
export {};
|