flavor-code 1.3.23 → 1.4.0-beta.1
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 +437 -434
- package/README.zh-CN.md +434 -431
- package/dist/{app-NTEUPJKJ.js → app-C5ZQUOKJ.js} +43 -155
- package/dist/astgraph/grammars.mjs +68 -68
- package/dist/astgraph/vendor/tree-sitter.js +3980 -3980
- package/dist/astgraph/vendor/zod/LICENSE +21 -21
- package/dist/astgraph/vendor/zod/index.js +4 -4
- package/dist/astgraph/vendor/zod/locales/index.js +1 -1
- package/dist/astgraph/vendor/zod/locales/package.json +7 -7
- package/dist/astgraph/vendor/zod/package.json +135 -135
- package/dist/astgraph/vendor/zod/v4/classic/checks.js +1 -1
- package/dist/astgraph/vendor/zod/v4/classic/coerce.js +17 -17
- package/dist/astgraph/vendor/zod/v4/classic/compat.js +31 -31
- package/dist/astgraph/vendor/zod/v4/classic/errors.js +48 -48
- package/dist/astgraph/vendor/zod/v4/classic/external.js +20 -20
- package/dist/astgraph/vendor/zod/v4/classic/from-json-schema.js +599 -599
- package/dist/astgraph/vendor/zod/v4/classic/index.js +4 -4
- package/dist/astgraph/vendor/zod/v4/classic/iso.js +30 -30
- package/dist/astgraph/vendor/zod/v4/classic/package.json +7 -7
- package/dist/astgraph/vendor/zod/v4/classic/parse.js +15 -15
- package/dist/astgraph/vendor/zod/v4/classic/schemas.js +1395 -1395
- package/dist/astgraph/vendor/zod/v4/core/api.js +1087 -1087
- package/dist/astgraph/vendor/zod/v4/core/checks.js +575 -575
- package/dist/astgraph/vendor/zod/v4/core/core.js +78 -78
- package/dist/astgraph/vendor/zod/v4/core/doc.js +35 -35
- package/dist/astgraph/vendor/zod/v4/core/errors.js +185 -185
- package/dist/astgraph/vendor/zod/v4/core/index.js +16 -16
- package/dist/astgraph/vendor/zod/v4/core/json-schema-generator.js +95 -95
- package/dist/astgraph/vendor/zod/v4/core/json-schema-processors.js +601 -601
- package/dist/astgraph/vendor/zod/v4/core/json-schema.js +1 -1
- package/dist/astgraph/vendor/zod/v4/core/package.json +7 -7
- package/dist/astgraph/vendor/zod/v4/core/parse.js +93 -93
- package/dist/astgraph/vendor/zod/v4/core/regexes.js +139 -139
- package/dist/astgraph/vendor/zod/v4/core/registries.js +51 -51
- package/dist/astgraph/vendor/zod/v4/core/schemas.js +2239 -2239
- package/dist/astgraph/vendor/zod/v4/core/standard-schema.js +1 -1
- package/dist/astgraph/vendor/zod/v4/core/to-json-schema.js +448 -448
- package/dist/astgraph/vendor/zod/v4/core/util.js +674 -674
- package/dist/astgraph/vendor/zod/v4/core/versions.js +5 -5
- package/dist/astgraph/vendor/zod/v4/index.js +3 -3
- package/dist/astgraph/vendor/zod/v4/locales/ar.js +106 -106
- package/dist/astgraph/vendor/zod/v4/locales/az.js +105 -105
- package/dist/astgraph/vendor/zod/v4/locales/be.js +156 -156
- package/dist/astgraph/vendor/zod/v4/locales/bg.js +120 -120
- package/dist/astgraph/vendor/zod/v4/locales/ca.js +107 -107
- package/dist/astgraph/vendor/zod/v4/locales/cs.js +111 -111
- package/dist/astgraph/vendor/zod/v4/locales/da.js +115 -115
- package/dist/astgraph/vendor/zod/v4/locales/de.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/el.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/en.js +113 -113
- package/dist/astgraph/vendor/zod/v4/locales/eo.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/es.js +132 -132
- package/dist/astgraph/vendor/zod/v4/locales/fa.js +114 -114
- package/dist/astgraph/vendor/zod/v4/locales/fi.js +112 -112
- package/dist/astgraph/vendor/zod/v4/locales/fr-CA.js +107 -107
- package/dist/astgraph/vendor/zod/v4/locales/fr.js +125 -125
- package/dist/astgraph/vendor/zod/v4/locales/he.js +214 -214
- package/dist/astgraph/vendor/zod/v4/locales/hr.js +122 -122
- package/dist/astgraph/vendor/zod/v4/locales/hu.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/hy.js +147 -147
- package/dist/astgraph/vendor/zod/v4/locales/id.js +106 -106
- package/dist/astgraph/vendor/zod/v4/locales/index.js +52 -52
- package/dist/astgraph/vendor/zod/v4/locales/is.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/it.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/ja.js +107 -107
- package/dist/astgraph/vendor/zod/v4/locales/ka.js +112 -112
- package/dist/astgraph/vendor/zod/v4/locales/kh.js +5 -5
- package/dist/astgraph/vendor/zod/v4/locales/km.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/ko.js +111 -111
- package/dist/astgraph/vendor/zod/v4/locales/lt.js +203 -203
- package/dist/astgraph/vendor/zod/v4/locales/mk.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/ms.js +107 -107
- package/dist/astgraph/vendor/zod/v4/locales/nl.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/no.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/ota.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/package.json +7 -7
- package/dist/astgraph/vendor/zod/v4/locales/pl.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/ps.js +114 -114
- package/dist/astgraph/vendor/zod/v4/locales/pt.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/ro.js +119 -119
- package/dist/astgraph/vendor/zod/v4/locales/ru.js +156 -156
- package/dist/astgraph/vendor/zod/v4/locales/sl.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/sv.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/ta.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/th.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/tr.js +105 -105
- package/dist/astgraph/vendor/zod/v4/locales/ua.js +5 -5
- package/dist/astgraph/vendor/zod/v4/locales/uk.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/ur.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/uz.js +110 -110
- package/dist/astgraph/vendor/zod/v4/locales/vi.js +108 -108
- package/dist/astgraph/vendor/zod/v4/locales/yo.js +107 -107
- package/dist/astgraph/vendor/zod/v4/locales/zh-CN.js +109 -109
- package/dist/astgraph/vendor/zod/v4/locales/zh-TW.js +107 -107
- package/dist/astgraph/vendor/zod/v4/mini/checks.js +1 -1
- package/dist/astgraph/vendor/zod/v4/mini/coerce.js +22 -22
- package/dist/astgraph/vendor/zod/v4/mini/external.js +14 -14
- package/dist/astgraph/vendor/zod/v4/mini/index.js +3 -3
- package/dist/astgraph/vendor/zod/v4/mini/iso.js +34 -34
- package/dist/astgraph/vendor/zod/v4/mini/package.json +7 -7
- package/dist/astgraph/vendor/zod/v4/mini/parse.js +1 -1
- package/dist/astgraph/vendor/zod/v4/mini/schemas.js +961 -961
- package/dist/astgraph/vendor/zod/v4/package.json +7 -7
- package/dist/{chunk-7OICVL2M.js → chunk-2BF7CVWZ.js} +0 -42
- package/dist/{chunk-RQTYHUMK.js → chunk-3WCDZ6ZL.js} +15 -0
- package/dist/{chunk-Z62P4LL7.js → chunk-6MNOZ2TX.js} +8962 -8422
- package/dist/{chunk-VEUSROUQ.js → chunk-FOTMP4ZS.js} +1 -1
- package/dist/{chunk-SUSLIHXO.js → chunk-ODRWR4KK.js} +1 -1
- package/dist/{chunk-RPFWB45Y.js → chunk-URUVFECH.js} +1 -1
- package/dist/{claude-ink-6CEG2XZZ.js → claude-ink-LP32NSX5.js} +2 -3
- package/dist/cli-main.js +27 -11
- package/dist/config/load.d.ts +2 -0
- package/dist/desktop/main.js +1092 -541
- package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +1 -0
- package/dist/desktop-renderer/assets/{index-D75ozXnZ.js → index-CqRIr-hz.js} +3 -3
- package/dist/desktop-renderer/assets/{interactive-terminal-CTFo4fK9.js → interactive-terminal-C4o7MNPO.js} +1 -1
- package/dist/desktop-renderer/index.html +2 -2
- package/dist/doctor.d.ts +38 -0
- package/dist/execution/docker.d.ts +5 -1
- package/dist/execution/types.d.ts +11 -0
- package/dist/jobs/registry.d.ts +1 -0
- package/dist/{load-4FWNXE6F.js → load-V2UIYYQI.js} +1 -1
- package/dist/sdk/index.js +4 -4
- package/dist/tools/shell.d.ts +17 -12
- package/dist/tools/types.d.ts +1 -0
- package/dist/ui/commands.d.ts +1 -1
- package/dist/ui/session.d.ts +1 -0
- package/dist/update/check.d.ts +20 -0
- package/dist/utils/semver.d.ts +3 -0
- package/dist/utils/spawn-executable.d.ts +2 -0
- package/package.json +1 -1
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +5848 -5848
- package/dist/chunk-OTYFL4AG.js +0 -16
- package/dist/desktop-renderer/assets/index-ZZsUx916.css +0 -1
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import * as util from "../core/util.js";
|
|
2
|
-
const error = () => {
|
|
3
|
-
const Sizable = {
|
|
4
|
-
string: { unit: "ký tự", verb: "có" },
|
|
5
|
-
file: { unit: "byte", verb: "có" },
|
|
6
|
-
array: { unit: "phần tử", verb: "có" },
|
|
7
|
-
set: { unit: "phần tử", verb: "có" },
|
|
8
|
-
};
|
|
9
|
-
function getSizing(origin) {
|
|
10
|
-
return Sizable[origin] ?? null;
|
|
11
|
-
}
|
|
12
|
-
const FormatDictionary = {
|
|
13
|
-
regex: "đầu vào",
|
|
14
|
-
email: "địa chỉ email",
|
|
15
|
-
url: "URL",
|
|
16
|
-
emoji: "emoji",
|
|
17
|
-
uuid: "UUID",
|
|
18
|
-
uuidv4: "UUIDv4",
|
|
19
|
-
uuidv6: "UUIDv6",
|
|
20
|
-
nanoid: "nanoid",
|
|
21
|
-
guid: "GUID",
|
|
22
|
-
cuid: "cuid",
|
|
23
|
-
cuid2: "cuid2",
|
|
24
|
-
ulid: "ULID",
|
|
25
|
-
xid: "XID",
|
|
26
|
-
ksuid: "KSUID",
|
|
27
|
-
datetime: "ngày giờ ISO",
|
|
28
|
-
date: "ngày ISO",
|
|
29
|
-
time: "giờ ISO",
|
|
30
|
-
duration: "khoảng thời gian ISO",
|
|
31
|
-
ipv4: "địa chỉ IPv4",
|
|
32
|
-
ipv6: "địa chỉ IPv6",
|
|
33
|
-
cidrv4: "dải IPv4",
|
|
34
|
-
cidrv6: "dải IPv6",
|
|
35
|
-
base64: "chuỗi mã hóa base64",
|
|
36
|
-
base64url: "chuỗi mã hóa base64url",
|
|
37
|
-
json_string: "chuỗi JSON",
|
|
38
|
-
e164: "số E.164",
|
|
39
|
-
jwt: "JWT",
|
|
40
|
-
template_literal: "đầu vào",
|
|
41
|
-
};
|
|
42
|
-
const TypeDictionary = {
|
|
43
|
-
nan: "NaN",
|
|
44
|
-
number: "số",
|
|
45
|
-
array: "mảng",
|
|
46
|
-
};
|
|
47
|
-
return (issue) => {
|
|
48
|
-
switch (issue.code) {
|
|
49
|
-
case "invalid_type": {
|
|
50
|
-
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
51
|
-
const receivedType = util.parsedType(issue.input);
|
|
52
|
-
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
53
|
-
if (/^[A-Z]/.test(issue.expected)) {
|
|
54
|
-
return `Đầu vào không hợp lệ: mong đợi instanceof ${issue.expected}, nhận được ${received}`;
|
|
55
|
-
}
|
|
56
|
-
return `Đầu vào không hợp lệ: mong đợi ${expected}, nhận được ${received}`;
|
|
57
|
-
}
|
|
58
|
-
case "invalid_value":
|
|
59
|
-
if (issue.values.length === 1)
|
|
60
|
-
return `Đầu vào không hợp lệ: mong đợi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
61
|
-
return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${util.joinValues(issue.values, "|")}`;
|
|
62
|
-
case "too_big": {
|
|
63
|
-
const adj = issue.inclusive ? "<=" : "<";
|
|
64
|
-
const sizing = getSizing(issue.origin);
|
|
65
|
-
if (sizing)
|
|
66
|
-
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "phần tử"}`;
|
|
67
|
-
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${adj}${issue.maximum.toString()}`;
|
|
68
|
-
}
|
|
69
|
-
case "too_small": {
|
|
70
|
-
const adj = issue.inclusive ? ">=" : ">";
|
|
71
|
-
const sizing = getSizing(issue.origin);
|
|
72
|
-
if (sizing) {
|
|
73
|
-
return `Quá nhỏ: mong đợi ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
74
|
-
}
|
|
75
|
-
return `Quá nhỏ: mong đợi ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
|
76
|
-
}
|
|
77
|
-
case "invalid_format": {
|
|
78
|
-
const _issue = issue;
|
|
79
|
-
if (_issue.format === "starts_with")
|
|
80
|
-
return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`;
|
|
81
|
-
if (_issue.format === "ends_with")
|
|
82
|
-
return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`;
|
|
83
|
-
if (_issue.format === "includes")
|
|
84
|
-
return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`;
|
|
85
|
-
if (_issue.format === "regex")
|
|
86
|
-
return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`;
|
|
87
|
-
return `${FormatDictionary[_issue.format] ?? issue.format} không hợp lệ`;
|
|
88
|
-
}
|
|
89
|
-
case "not_multiple_of":
|
|
90
|
-
return `Số không hợp lệ: phải là bội số của ${issue.divisor}`;
|
|
91
|
-
case "unrecognized_keys":
|
|
92
|
-
return `Khóa không được nhận dạng: ${util.joinValues(issue.keys, ", ")}`;
|
|
93
|
-
case "invalid_key":
|
|
94
|
-
return `Khóa không hợp lệ trong ${issue.origin}`;
|
|
95
|
-
case "invalid_union":
|
|
96
|
-
return "Đầu vào không hợp lệ";
|
|
97
|
-
case "invalid_element":
|
|
98
|
-
return `Giá trị không hợp lệ trong ${issue.origin}`;
|
|
99
|
-
default:
|
|
100
|
-
return `Đầu vào không hợp lệ`;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
export default function () {
|
|
105
|
-
return {
|
|
106
|
-
localeError: error(),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "ký tự", verb: "có" },
|
|
5
|
+
file: { unit: "byte", verb: "có" },
|
|
6
|
+
array: { unit: "phần tử", verb: "có" },
|
|
7
|
+
set: { unit: "phần tử", verb: "có" },
|
|
8
|
+
};
|
|
9
|
+
function getSizing(origin) {
|
|
10
|
+
return Sizable[origin] ?? null;
|
|
11
|
+
}
|
|
12
|
+
const FormatDictionary = {
|
|
13
|
+
regex: "đầu vào",
|
|
14
|
+
email: "địa chỉ email",
|
|
15
|
+
url: "URL",
|
|
16
|
+
emoji: "emoji",
|
|
17
|
+
uuid: "UUID",
|
|
18
|
+
uuidv4: "UUIDv4",
|
|
19
|
+
uuidv6: "UUIDv6",
|
|
20
|
+
nanoid: "nanoid",
|
|
21
|
+
guid: "GUID",
|
|
22
|
+
cuid: "cuid",
|
|
23
|
+
cuid2: "cuid2",
|
|
24
|
+
ulid: "ULID",
|
|
25
|
+
xid: "XID",
|
|
26
|
+
ksuid: "KSUID",
|
|
27
|
+
datetime: "ngày giờ ISO",
|
|
28
|
+
date: "ngày ISO",
|
|
29
|
+
time: "giờ ISO",
|
|
30
|
+
duration: "khoảng thời gian ISO",
|
|
31
|
+
ipv4: "địa chỉ IPv4",
|
|
32
|
+
ipv6: "địa chỉ IPv6",
|
|
33
|
+
cidrv4: "dải IPv4",
|
|
34
|
+
cidrv6: "dải IPv6",
|
|
35
|
+
base64: "chuỗi mã hóa base64",
|
|
36
|
+
base64url: "chuỗi mã hóa base64url",
|
|
37
|
+
json_string: "chuỗi JSON",
|
|
38
|
+
e164: "số E.164",
|
|
39
|
+
jwt: "JWT",
|
|
40
|
+
template_literal: "đầu vào",
|
|
41
|
+
};
|
|
42
|
+
const TypeDictionary = {
|
|
43
|
+
nan: "NaN",
|
|
44
|
+
number: "số",
|
|
45
|
+
array: "mảng",
|
|
46
|
+
};
|
|
47
|
+
return (issue) => {
|
|
48
|
+
switch (issue.code) {
|
|
49
|
+
case "invalid_type": {
|
|
50
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
51
|
+
const receivedType = util.parsedType(issue.input);
|
|
52
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
53
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
54
|
+
return `Đầu vào không hợp lệ: mong đợi instanceof ${issue.expected}, nhận được ${received}`;
|
|
55
|
+
}
|
|
56
|
+
return `Đầu vào không hợp lệ: mong đợi ${expected}, nhận được ${received}`;
|
|
57
|
+
}
|
|
58
|
+
case "invalid_value":
|
|
59
|
+
if (issue.values.length === 1)
|
|
60
|
+
return `Đầu vào không hợp lệ: mong đợi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
61
|
+
return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${util.joinValues(issue.values, "|")}`;
|
|
62
|
+
case "too_big": {
|
|
63
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
64
|
+
const sizing = getSizing(issue.origin);
|
|
65
|
+
if (sizing)
|
|
66
|
+
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "phần tử"}`;
|
|
67
|
+
return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${adj}${issue.maximum.toString()}`;
|
|
68
|
+
}
|
|
69
|
+
case "too_small": {
|
|
70
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
71
|
+
const sizing = getSizing(issue.origin);
|
|
72
|
+
if (sizing) {
|
|
73
|
+
return `Quá nhỏ: mong đợi ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
74
|
+
}
|
|
75
|
+
return `Quá nhỏ: mong đợi ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
|
76
|
+
}
|
|
77
|
+
case "invalid_format": {
|
|
78
|
+
const _issue = issue;
|
|
79
|
+
if (_issue.format === "starts_with")
|
|
80
|
+
return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`;
|
|
81
|
+
if (_issue.format === "ends_with")
|
|
82
|
+
return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`;
|
|
83
|
+
if (_issue.format === "includes")
|
|
84
|
+
return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`;
|
|
85
|
+
if (_issue.format === "regex")
|
|
86
|
+
return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`;
|
|
87
|
+
return `${FormatDictionary[_issue.format] ?? issue.format} không hợp lệ`;
|
|
88
|
+
}
|
|
89
|
+
case "not_multiple_of":
|
|
90
|
+
return `Số không hợp lệ: phải là bội số của ${issue.divisor}`;
|
|
91
|
+
case "unrecognized_keys":
|
|
92
|
+
return `Khóa không được nhận dạng: ${util.joinValues(issue.keys, ", ")}`;
|
|
93
|
+
case "invalid_key":
|
|
94
|
+
return `Khóa không hợp lệ trong ${issue.origin}`;
|
|
95
|
+
case "invalid_union":
|
|
96
|
+
return "Đầu vào không hợp lệ";
|
|
97
|
+
case "invalid_element":
|
|
98
|
+
return `Giá trị không hợp lệ trong ${issue.origin}`;
|
|
99
|
+
default:
|
|
100
|
+
return `Đầu vào không hợp lệ`;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export default function () {
|
|
105
|
+
return {
|
|
106
|
+
localeError: error(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import * as util from "../core/util.js";
|
|
2
|
-
const error = () => {
|
|
3
|
-
const Sizable = {
|
|
4
|
-
string: { unit: "àmi", verb: "ní" },
|
|
5
|
-
file: { unit: "bytes", verb: "ní" },
|
|
6
|
-
array: { unit: "nkan", verb: "ní" },
|
|
7
|
-
set: { unit: "nkan", verb: "ní" },
|
|
8
|
-
};
|
|
9
|
-
function getSizing(origin) {
|
|
10
|
-
return Sizable[origin] ?? null;
|
|
11
|
-
}
|
|
12
|
-
const FormatDictionary = {
|
|
13
|
-
regex: "ẹ̀rọ ìbáwọlé",
|
|
14
|
-
email: "àdírẹ́sì ìmẹ́lì",
|
|
15
|
-
url: "URL",
|
|
16
|
-
emoji: "emoji",
|
|
17
|
-
uuid: "UUID",
|
|
18
|
-
uuidv4: "UUIDv4",
|
|
19
|
-
uuidv6: "UUIDv6",
|
|
20
|
-
nanoid: "nanoid",
|
|
21
|
-
guid: "GUID",
|
|
22
|
-
cuid: "cuid",
|
|
23
|
-
cuid2: "cuid2",
|
|
24
|
-
ulid: "ULID",
|
|
25
|
-
xid: "XID",
|
|
26
|
-
ksuid: "KSUID",
|
|
27
|
-
datetime: "àkókò ISO",
|
|
28
|
-
date: "ọjọ́ ISO",
|
|
29
|
-
time: "àkókò ISO",
|
|
30
|
-
duration: "àkókò tó pé ISO",
|
|
31
|
-
ipv4: "àdírẹ́sì IPv4",
|
|
32
|
-
ipv6: "àdírẹ́sì IPv6",
|
|
33
|
-
cidrv4: "àgbègbè IPv4",
|
|
34
|
-
cidrv6: "àgbègbè IPv6",
|
|
35
|
-
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
|
|
36
|
-
base64url: "ọ̀rọ̀ base64url",
|
|
37
|
-
json_string: "ọ̀rọ̀ JSON",
|
|
38
|
-
e164: "nọ́mbà E.164",
|
|
39
|
-
jwt: "JWT",
|
|
40
|
-
template_literal: "ẹ̀rọ ìbáwọlé",
|
|
41
|
-
};
|
|
42
|
-
const TypeDictionary = {
|
|
43
|
-
nan: "NaN",
|
|
44
|
-
number: "nọ́mbà",
|
|
45
|
-
array: "akopọ",
|
|
46
|
-
};
|
|
47
|
-
return (issue) => {
|
|
48
|
-
switch (issue.code) {
|
|
49
|
-
case "invalid_type": {
|
|
50
|
-
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
51
|
-
const receivedType = util.parsedType(issue.input);
|
|
52
|
-
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
53
|
-
if (/^[A-Z]/.test(issue.expected)) {
|
|
54
|
-
return `Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${issue.expected}, àmọ̀ a rí ${received}`;
|
|
55
|
-
}
|
|
56
|
-
return `Ìbáwọlé aṣìṣe: a ní láti fi ${expected}, àmọ̀ a rí ${received}`;
|
|
57
|
-
}
|
|
58
|
-
case "invalid_value":
|
|
59
|
-
if (issue.values.length === 1)
|
|
60
|
-
return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
61
|
-
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`;
|
|
62
|
-
case "too_big": {
|
|
63
|
-
const adj = issue.inclusive ? "<=" : "<";
|
|
64
|
-
const sizing = getSizing(issue.origin);
|
|
65
|
-
if (sizing)
|
|
66
|
-
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`;
|
|
67
|
-
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`;
|
|
68
|
-
}
|
|
69
|
-
case "too_small": {
|
|
70
|
-
const adj = issue.inclusive ? ">=" : ">";
|
|
71
|
-
const sizing = getSizing(issue.origin);
|
|
72
|
-
if (sizing)
|
|
73
|
-
return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`;
|
|
74
|
-
return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`;
|
|
75
|
-
}
|
|
76
|
-
case "invalid_format": {
|
|
77
|
-
const _issue = issue;
|
|
78
|
-
if (_issue.format === "starts_with")
|
|
79
|
-
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
|
|
80
|
-
if (_issue.format === "ends_with")
|
|
81
|
-
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
|
|
82
|
-
if (_issue.format === "includes")
|
|
83
|
-
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
|
|
84
|
-
if (_issue.format === "regex")
|
|
85
|
-
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
|
|
86
|
-
return `Aṣìṣe: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
87
|
-
}
|
|
88
|
-
case "not_multiple_of":
|
|
89
|
-
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`;
|
|
90
|
-
case "unrecognized_keys":
|
|
91
|
-
return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`;
|
|
92
|
-
case "invalid_key":
|
|
93
|
-
return `Bọtìnì aṣìṣe nínú ${issue.origin}`;
|
|
94
|
-
case "invalid_union":
|
|
95
|
-
return "Ìbáwọlé aṣìṣe";
|
|
96
|
-
case "invalid_element":
|
|
97
|
-
return `Iye aṣìṣe nínú ${issue.origin}`;
|
|
98
|
-
default:
|
|
99
|
-
return "Ìbáwọlé aṣìṣe";
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export default function () {
|
|
104
|
-
return {
|
|
105
|
-
localeError: error(),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "àmi", verb: "ní" },
|
|
5
|
+
file: { unit: "bytes", verb: "ní" },
|
|
6
|
+
array: { unit: "nkan", verb: "ní" },
|
|
7
|
+
set: { unit: "nkan", verb: "ní" },
|
|
8
|
+
};
|
|
9
|
+
function getSizing(origin) {
|
|
10
|
+
return Sizable[origin] ?? null;
|
|
11
|
+
}
|
|
12
|
+
const FormatDictionary = {
|
|
13
|
+
regex: "ẹ̀rọ ìbáwọlé",
|
|
14
|
+
email: "àdírẹ́sì ìmẹ́lì",
|
|
15
|
+
url: "URL",
|
|
16
|
+
emoji: "emoji",
|
|
17
|
+
uuid: "UUID",
|
|
18
|
+
uuidv4: "UUIDv4",
|
|
19
|
+
uuidv6: "UUIDv6",
|
|
20
|
+
nanoid: "nanoid",
|
|
21
|
+
guid: "GUID",
|
|
22
|
+
cuid: "cuid",
|
|
23
|
+
cuid2: "cuid2",
|
|
24
|
+
ulid: "ULID",
|
|
25
|
+
xid: "XID",
|
|
26
|
+
ksuid: "KSUID",
|
|
27
|
+
datetime: "àkókò ISO",
|
|
28
|
+
date: "ọjọ́ ISO",
|
|
29
|
+
time: "àkókò ISO",
|
|
30
|
+
duration: "àkókò tó pé ISO",
|
|
31
|
+
ipv4: "àdírẹ́sì IPv4",
|
|
32
|
+
ipv6: "àdírẹ́sì IPv6",
|
|
33
|
+
cidrv4: "àgbègbè IPv4",
|
|
34
|
+
cidrv6: "àgbègbè IPv6",
|
|
35
|
+
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
|
|
36
|
+
base64url: "ọ̀rọ̀ base64url",
|
|
37
|
+
json_string: "ọ̀rọ̀ JSON",
|
|
38
|
+
e164: "nọ́mbà E.164",
|
|
39
|
+
jwt: "JWT",
|
|
40
|
+
template_literal: "ẹ̀rọ ìbáwọlé",
|
|
41
|
+
};
|
|
42
|
+
const TypeDictionary = {
|
|
43
|
+
nan: "NaN",
|
|
44
|
+
number: "nọ́mbà",
|
|
45
|
+
array: "akopọ",
|
|
46
|
+
};
|
|
47
|
+
return (issue) => {
|
|
48
|
+
switch (issue.code) {
|
|
49
|
+
case "invalid_type": {
|
|
50
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
51
|
+
const receivedType = util.parsedType(issue.input);
|
|
52
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
53
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
54
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${issue.expected}, àmọ̀ a rí ${received}`;
|
|
55
|
+
}
|
|
56
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${expected}, àmọ̀ a rí ${received}`;
|
|
57
|
+
}
|
|
58
|
+
case "invalid_value":
|
|
59
|
+
if (issue.values.length === 1)
|
|
60
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
61
|
+
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`;
|
|
62
|
+
case "too_big": {
|
|
63
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
64
|
+
const sizing = getSizing(issue.origin);
|
|
65
|
+
if (sizing)
|
|
66
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`;
|
|
67
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`;
|
|
68
|
+
}
|
|
69
|
+
case "too_small": {
|
|
70
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
71
|
+
const sizing = getSizing(issue.origin);
|
|
72
|
+
if (sizing)
|
|
73
|
+
return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`;
|
|
74
|
+
return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`;
|
|
75
|
+
}
|
|
76
|
+
case "invalid_format": {
|
|
77
|
+
const _issue = issue;
|
|
78
|
+
if (_issue.format === "starts_with")
|
|
79
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
|
|
80
|
+
if (_issue.format === "ends_with")
|
|
81
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
|
|
82
|
+
if (_issue.format === "includes")
|
|
83
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
|
|
84
|
+
if (_issue.format === "regex")
|
|
85
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
|
|
86
|
+
return `Aṣìṣe: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
87
|
+
}
|
|
88
|
+
case "not_multiple_of":
|
|
89
|
+
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`;
|
|
90
|
+
case "unrecognized_keys":
|
|
91
|
+
return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`;
|
|
92
|
+
case "invalid_key":
|
|
93
|
+
return `Bọtìnì aṣìṣe nínú ${issue.origin}`;
|
|
94
|
+
case "invalid_union":
|
|
95
|
+
return "Ìbáwọlé aṣìṣe";
|
|
96
|
+
case "invalid_element":
|
|
97
|
+
return `Iye aṣìṣe nínú ${issue.origin}`;
|
|
98
|
+
default:
|
|
99
|
+
return "Ìbáwọlé aṣìṣe";
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export default function () {
|
|
104
|
+
return {
|
|
105
|
+
localeError: error(),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import * as util from "../core/util.js";
|
|
2
|
-
const error = () => {
|
|
3
|
-
const Sizable = {
|
|
4
|
-
string: { unit: "字符", verb: "包含" },
|
|
5
|
-
file: { unit: "字节", verb: "包含" },
|
|
6
|
-
array: { unit: "项", verb: "包含" },
|
|
7
|
-
set: { unit: "项", verb: "包含" },
|
|
8
|
-
};
|
|
9
|
-
function getSizing(origin) {
|
|
10
|
-
return Sizable[origin] ?? null;
|
|
11
|
-
}
|
|
12
|
-
const FormatDictionary = {
|
|
13
|
-
regex: "输入",
|
|
14
|
-
email: "电子邮件",
|
|
15
|
-
url: "URL",
|
|
16
|
-
emoji: "表情符号",
|
|
17
|
-
uuid: "UUID",
|
|
18
|
-
uuidv4: "UUIDv4",
|
|
19
|
-
uuidv6: "UUIDv6",
|
|
20
|
-
nanoid: "nanoid",
|
|
21
|
-
guid: "GUID",
|
|
22
|
-
cuid: "cuid",
|
|
23
|
-
cuid2: "cuid2",
|
|
24
|
-
ulid: "ULID",
|
|
25
|
-
xid: "XID",
|
|
26
|
-
ksuid: "KSUID",
|
|
27
|
-
datetime: "ISO日期时间",
|
|
28
|
-
date: "ISO日期",
|
|
29
|
-
time: "ISO时间",
|
|
30
|
-
duration: "ISO时长",
|
|
31
|
-
ipv4: "IPv4地址",
|
|
32
|
-
ipv6: "IPv6地址",
|
|
33
|
-
cidrv4: "IPv4网段",
|
|
34
|
-
cidrv6: "IPv6网段",
|
|
35
|
-
base64: "base64编码字符串",
|
|
36
|
-
base64url: "base64url编码字符串",
|
|
37
|
-
json_string: "JSON字符串",
|
|
38
|
-
e164: "E.164号码",
|
|
39
|
-
jwt: "JWT",
|
|
40
|
-
template_literal: "输入",
|
|
41
|
-
};
|
|
42
|
-
const TypeDictionary = {
|
|
43
|
-
nan: "NaN",
|
|
44
|
-
number: "数字",
|
|
45
|
-
array: "数组",
|
|
46
|
-
null: "空值(null)",
|
|
47
|
-
};
|
|
48
|
-
return (issue) => {
|
|
49
|
-
switch (issue.code) {
|
|
50
|
-
case "invalid_type": {
|
|
51
|
-
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
52
|
-
const receivedType = util.parsedType(issue.input);
|
|
53
|
-
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
54
|
-
if (/^[A-Z]/.test(issue.expected)) {
|
|
55
|
-
return `无效输入:期望 instanceof ${issue.expected},实际接收 ${received}`;
|
|
56
|
-
}
|
|
57
|
-
return `无效输入:期望 ${expected},实际接收 ${received}`;
|
|
58
|
-
}
|
|
59
|
-
case "invalid_value":
|
|
60
|
-
if (issue.values.length === 1)
|
|
61
|
-
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
|
|
62
|
-
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
|
|
63
|
-
case "too_big": {
|
|
64
|
-
const adj = issue.inclusive ? "<=" : "<";
|
|
65
|
-
const sizing = getSizing(issue.origin);
|
|
66
|
-
if (sizing)
|
|
67
|
-
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
|
|
68
|
-
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
|
|
69
|
-
}
|
|
70
|
-
case "too_small": {
|
|
71
|
-
const adj = issue.inclusive ? ">=" : ">";
|
|
72
|
-
const sizing = getSizing(issue.origin);
|
|
73
|
-
if (sizing) {
|
|
74
|
-
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
75
|
-
}
|
|
76
|
-
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
|
77
|
-
}
|
|
78
|
-
case "invalid_format": {
|
|
79
|
-
const _issue = issue;
|
|
80
|
-
if (_issue.format === "starts_with")
|
|
81
|
-
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
|
|
82
|
-
if (_issue.format === "ends_with")
|
|
83
|
-
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
|
|
84
|
-
if (_issue.format === "includes")
|
|
85
|
-
return `无效字符串:必须包含 "${_issue.includes}"`;
|
|
86
|
-
if (_issue.format === "regex")
|
|
87
|
-
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
|
|
88
|
-
return `无效${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
89
|
-
}
|
|
90
|
-
case "not_multiple_of":
|
|
91
|
-
return `无效数字:必须是 ${issue.divisor} 的倍数`;
|
|
92
|
-
case "unrecognized_keys":
|
|
93
|
-
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
|
|
94
|
-
case "invalid_key":
|
|
95
|
-
return `${issue.origin} 中的键(key)无效`;
|
|
96
|
-
case "invalid_union":
|
|
97
|
-
return "无效输入";
|
|
98
|
-
case "invalid_element":
|
|
99
|
-
return `${issue.origin} 中包含无效值(value)`;
|
|
100
|
-
default:
|
|
101
|
-
return `无效输入`;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
export default function () {
|
|
106
|
-
return {
|
|
107
|
-
localeError: error(),
|
|
108
|
-
};
|
|
109
|
-
}
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "字符", verb: "包含" },
|
|
5
|
+
file: { unit: "字节", verb: "包含" },
|
|
6
|
+
array: { unit: "项", verb: "包含" },
|
|
7
|
+
set: { unit: "项", verb: "包含" },
|
|
8
|
+
};
|
|
9
|
+
function getSizing(origin) {
|
|
10
|
+
return Sizable[origin] ?? null;
|
|
11
|
+
}
|
|
12
|
+
const FormatDictionary = {
|
|
13
|
+
regex: "输入",
|
|
14
|
+
email: "电子邮件",
|
|
15
|
+
url: "URL",
|
|
16
|
+
emoji: "表情符号",
|
|
17
|
+
uuid: "UUID",
|
|
18
|
+
uuidv4: "UUIDv4",
|
|
19
|
+
uuidv6: "UUIDv6",
|
|
20
|
+
nanoid: "nanoid",
|
|
21
|
+
guid: "GUID",
|
|
22
|
+
cuid: "cuid",
|
|
23
|
+
cuid2: "cuid2",
|
|
24
|
+
ulid: "ULID",
|
|
25
|
+
xid: "XID",
|
|
26
|
+
ksuid: "KSUID",
|
|
27
|
+
datetime: "ISO日期时间",
|
|
28
|
+
date: "ISO日期",
|
|
29
|
+
time: "ISO时间",
|
|
30
|
+
duration: "ISO时长",
|
|
31
|
+
ipv4: "IPv4地址",
|
|
32
|
+
ipv6: "IPv6地址",
|
|
33
|
+
cidrv4: "IPv4网段",
|
|
34
|
+
cidrv6: "IPv6网段",
|
|
35
|
+
base64: "base64编码字符串",
|
|
36
|
+
base64url: "base64url编码字符串",
|
|
37
|
+
json_string: "JSON字符串",
|
|
38
|
+
e164: "E.164号码",
|
|
39
|
+
jwt: "JWT",
|
|
40
|
+
template_literal: "输入",
|
|
41
|
+
};
|
|
42
|
+
const TypeDictionary = {
|
|
43
|
+
nan: "NaN",
|
|
44
|
+
number: "数字",
|
|
45
|
+
array: "数组",
|
|
46
|
+
null: "空值(null)",
|
|
47
|
+
};
|
|
48
|
+
return (issue) => {
|
|
49
|
+
switch (issue.code) {
|
|
50
|
+
case "invalid_type": {
|
|
51
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
52
|
+
const receivedType = util.parsedType(issue.input);
|
|
53
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
54
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
55
|
+
return `无效输入:期望 instanceof ${issue.expected},实际接收 ${received}`;
|
|
56
|
+
}
|
|
57
|
+
return `无效输入:期望 ${expected},实际接收 ${received}`;
|
|
58
|
+
}
|
|
59
|
+
case "invalid_value":
|
|
60
|
+
if (issue.values.length === 1)
|
|
61
|
+
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
|
|
62
|
+
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
|
|
63
|
+
case "too_big": {
|
|
64
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
65
|
+
const sizing = getSizing(issue.origin);
|
|
66
|
+
if (sizing)
|
|
67
|
+
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
|
|
68
|
+
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
|
|
69
|
+
}
|
|
70
|
+
case "too_small": {
|
|
71
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
72
|
+
const sizing = getSizing(issue.origin);
|
|
73
|
+
if (sizing) {
|
|
74
|
+
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
75
|
+
}
|
|
76
|
+
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
|
77
|
+
}
|
|
78
|
+
case "invalid_format": {
|
|
79
|
+
const _issue = issue;
|
|
80
|
+
if (_issue.format === "starts_with")
|
|
81
|
+
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
|
|
82
|
+
if (_issue.format === "ends_with")
|
|
83
|
+
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
|
|
84
|
+
if (_issue.format === "includes")
|
|
85
|
+
return `无效字符串:必须包含 "${_issue.includes}"`;
|
|
86
|
+
if (_issue.format === "regex")
|
|
87
|
+
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
|
|
88
|
+
return `无效${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
89
|
+
}
|
|
90
|
+
case "not_multiple_of":
|
|
91
|
+
return `无效数字:必须是 ${issue.divisor} 的倍数`;
|
|
92
|
+
case "unrecognized_keys":
|
|
93
|
+
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
|
|
94
|
+
case "invalid_key":
|
|
95
|
+
return `${issue.origin} 中的键(key)无效`;
|
|
96
|
+
case "invalid_union":
|
|
97
|
+
return "无效输入";
|
|
98
|
+
case "invalid_element":
|
|
99
|
+
return `${issue.origin} 中包含无效值(value)`;
|
|
100
|
+
default:
|
|
101
|
+
return `无效输入`;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export default function () {
|
|
106
|
+
return {
|
|
107
|
+
localeError: error(),
|
|
108
|
+
};
|
|
109
|
+
}
|