@npm-questionpro/wick-ui-i18n 0.5.0 → 0.7.0
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/index.js +29 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,9 +7,21 @@ const traverse = _traverse.default || _traverse;
|
|
|
7
7
|
|
|
8
8
|
class TranslationProcessor {
|
|
9
9
|
constructor(options) {
|
|
10
|
-
this.components = new Set(options.components
|
|
10
|
+
this.components = new Set(options.components);
|
|
11
11
|
this.ignoreComponents = new Set(
|
|
12
|
-
options.ignoreComponents || [
|
|
12
|
+
options.ignoreComponents || [
|
|
13
|
+
"WuIcon",
|
|
14
|
+
"WuTranslateProvider",
|
|
15
|
+
"WuHelpButton",
|
|
16
|
+
"WuActivityLog",
|
|
17
|
+
"WuAppHeader",
|
|
18
|
+
"WuCopyToClipboard",
|
|
19
|
+
"WuMenuIcon",
|
|
20
|
+
"WuScrollArea",
|
|
21
|
+
"WuDrawer",
|
|
22
|
+
"WuLoader",
|
|
23
|
+
"WuContentEditor",
|
|
24
|
+
],
|
|
13
25
|
);
|
|
14
26
|
this.dictionary = new Map();
|
|
15
27
|
this.debugEnabled = options.debug || false;
|
|
@@ -58,8 +70,8 @@ class TranslationProcessor {
|
|
|
58
70
|
const hasWrapper = attrs.some(
|
|
59
71
|
(a) => a.name?.name === "data-i18n-wrapper",
|
|
60
72
|
);
|
|
61
|
-
|
|
62
|
-
const isTarget = this.components.has(name);
|
|
73
|
+
const isTarget = this.components.has(name) || name?.startsWith("Wu");
|
|
74
|
+
// const isTarget = this.components.has(name);
|
|
63
75
|
|
|
64
76
|
if (hasWrapper || isTarget) {
|
|
65
77
|
targetFound = true;
|
|
@@ -157,6 +169,19 @@ export default function wickuiI18nPlugin(options = {}) {
|
|
|
157
169
|
: null;
|
|
158
170
|
},
|
|
159
171
|
|
|
172
|
+
buildStart() {
|
|
173
|
+
processor.dictionary.clear();
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
configureServer(server) {
|
|
177
|
+
server.middlewares.use("/wick-ui-i18n.json", (req, res) => {
|
|
178
|
+
res.setHeader("Content-Type", "application/json");
|
|
179
|
+
res.end(
|
|
180
|
+
JSON.stringify(Object.fromEntries(processor.dictionary), null, 2),
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
|
|
160
185
|
generateBundle() {
|
|
161
186
|
this.emitFile({
|
|
162
187
|
type: "asset",
|