@npm-questionpro/wick-ui-i18n 0.2.0 → 0.5.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 +1 -1
- package/package.json +1 -1
- package/wickuii18n.test.js +6 -12
package/index.js
CHANGED
|
@@ -113,7 +113,7 @@ export default function wickuiI18nPlugin(options = {}) {
|
|
|
113
113
|
ms.overwrite(
|
|
114
114
|
start,
|
|
115
115
|
end,
|
|
116
|
-
`<WuTranslate __i18nKey=${JSON.stringify(key)}
|
|
116
|
+
`<WuTranslate __i18nKey=${JSON.stringify(key)}></WuTranslate>`,
|
|
117
117
|
);
|
|
118
118
|
needsImport = true;
|
|
119
119
|
};
|
package/package.json
CHANGED
package/wickuii18n.test.js
CHANGED
|
@@ -13,9 +13,7 @@ describe("Wick UI i18n Vite Plugin", () => {
|
|
|
13
13
|
const code = `<WuButton>Submit</WuButton>`;
|
|
14
14
|
const result = transform(code);
|
|
15
15
|
expect(result).toContain(`import { WuTranslate }`);
|
|
16
|
-
expect(result).toContain(
|
|
17
|
-
`<WuTranslate __i18nKey="Submit">Submit</WuTranslate>`,
|
|
18
|
-
);
|
|
16
|
+
expect(result).toContain(`<WuTranslate __i18nKey="Submit"></WuTranslate>`);
|
|
19
17
|
});
|
|
20
18
|
|
|
21
19
|
it("2. Ignores components in the ignoreComponents list", () => {
|
|
@@ -27,18 +25,14 @@ describe("Wick UI i18n Vite Plugin", () => {
|
|
|
27
25
|
it("3. Handles smart nested ignored components (Ignored inside Target)", () => {
|
|
28
26
|
const code = `<WuButton>Click <WuIcon>star</WuIcon></WuButton>`;
|
|
29
27
|
const result = transform(code);
|
|
30
|
-
expect(result).toContain(
|
|
31
|
-
`<WuTranslate __i18nKey="Click">Click</WuTranslate>`,
|
|
32
|
-
);
|
|
28
|
+
expect(result).toContain(`<WuTranslate __i18nKey="Click"></WuTranslate>`);
|
|
33
29
|
expect(result).toContain(`<WuIcon>star</WuIcon>`);
|
|
34
30
|
});
|
|
35
31
|
|
|
36
32
|
it("4. Handles smart nested target components (Target inside regular HTML)", () => {
|
|
37
33
|
const code = `<WuProvider><div><WuButton>Save</WuButton></div></WuProvider>`;
|
|
38
34
|
const result = transform(code);
|
|
39
|
-
expect(result).toContain(
|
|
40
|
-
`<WuTranslate __i18nKey="Save">Save</WuTranslate>`,
|
|
41
|
-
);
|
|
35
|
+
expect(result).toContain(`<WuTranslate __i18nKey="Save"></WuTranslate>`);
|
|
42
36
|
});
|
|
43
37
|
|
|
44
38
|
it("5. Respects data-skip and data-i18n-skip flags", () => {
|
|
@@ -52,7 +46,7 @@ describe("Wick UI i18n Vite Plugin", () => {
|
|
|
52
46
|
const code = `<WuButton data-i18n-key="btn_login">Log In</WuButton>`;
|
|
53
47
|
const result = transform(code);
|
|
54
48
|
expect(result).toContain(
|
|
55
|
-
`<WuTranslate __i18nKey="btn_login"
|
|
49
|
+
`<WuTranslate __i18nKey="btn_login"></WuTranslate>`,
|
|
56
50
|
);
|
|
57
51
|
});
|
|
58
52
|
|
|
@@ -60,7 +54,7 @@ describe("Wick UI i18n Vite Plugin", () => {
|
|
|
60
54
|
const code = `<WuButton>{"Hello World"}</WuButton>`;
|
|
61
55
|
const result = transform(code);
|
|
62
56
|
expect(result).toContain(
|
|
63
|
-
`<WuTranslate __i18nKey="Hello World"
|
|
57
|
+
`<WuTranslate __i18nKey="Hello World"></WuTranslate>`,
|
|
64
58
|
);
|
|
65
59
|
});
|
|
66
60
|
|
|
@@ -77,7 +71,7 @@ describe("Wick UI i18n Vite Plugin", () => {
|
|
|
77
71
|
const triggerCode = `import { WuPlaceholder } from 'lib';\n` + code;
|
|
78
72
|
const result = transform(triggerCode);
|
|
79
73
|
expect(result).toContain(
|
|
80
|
-
`<WuTranslate __i18nKey="Wrapped Text"
|
|
74
|
+
`<WuTranslate __i18nKey="Wrapped Text"></WuTranslate>`,
|
|
81
75
|
);
|
|
82
76
|
});
|
|
83
77
|
});
|