@kine-design/core 0.0.1-beta.10 → 0.0.1-beta.12
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/.vlaude/last-session-id +1 -1
- package/components/base/autoComplete/api.ts +1 -1
- package/components/base/cascader/api.ts +1 -1
- package/components/base/datePicker/__tests__/useDatePicker.test.ts +8 -17
- package/components/base/datePicker/api.ts +1 -1
- package/components/base/datePicker/index.ts +1 -1
- package/components/base/datePicker/useDatePicker.ts +1 -18
- package/components/base/empty/api.ts +1 -1
- package/components/base/select/api.ts +1 -1
- package/components/base/timePicker/__tests__/useTimePicker.test.ts +5 -4
- package/components/base/timePicker/api.ts +1 -1
- package/components/base/timePicker/useTimePicker.ts +1 -1
- package/components/base/transfer/api.ts +2 -2
- package/components/message/confirm/api.ts +2 -2
- package/compositions/common/useLocale.ts +53 -0
- package/dist/components/base/datePicker/index.d.ts +1 -1
- package/dist/components/base/datePicker/useDatePicker.d.ts +0 -7
- package/dist/compositions/common/useLocale.d.ts +14 -0
- package/dist/core.js +467 -57
- package/dist/index.d.ts +2 -0
- package/dist/locale/en.d.ts +3 -0
- package/dist/locale/index.d.ts +9 -0
- package/dist/locale/types.d.ts +222 -0
- package/dist/locale/zh.d.ts +3 -0
- package/index.ts +10 -0
- package/locale/.vlaude/last-session-id +1 -0
- package/locale/en.ts +187 -0
- package/locale/index.ts +29 -0
- package/locale/types.ts +214 -0
- package/locale/zh.ts +190 -0
- package/package.json +18 -20
- package/.vlaude/session-switch.signal +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description kine-design locale message contract.
|
|
3
|
+
* The single source of truth for every user-facing string in the component
|
|
4
|
+
* library. Each language pack (zh / en) must implement this interface in
|
|
5
|
+
* full — a missing key is a compile error, which is exactly the guarantee we
|
|
6
|
+
* want so translations never silently drift out of sync.
|
|
7
|
+
* @author kine-design
|
|
8
|
+
* @version v1.0.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Built-in language pack identifiers. The library ships only the two general
|
|
12
|
+
* languages (zh / en). App-specific languages — e.g. Bengali in the factory —
|
|
13
|
+
* are supplied by the consumer as a full `KineLocaleMessages` object passed to
|
|
14
|
+
* `<KConfigProvider :locale="...">`, not bundled here.
|
|
15
|
+
*/
|
|
16
|
+
export type KineLocaleName = 'zh' | 'en';
|
|
17
|
+
/** Full message dictionary consumed by components via `useLocale()`. */
|
|
18
|
+
export interface KineLocaleMessages {
|
|
19
|
+
/** Shared atoms reused across many components. */
|
|
20
|
+
common: {
|
|
21
|
+
confirm: string;
|
|
22
|
+
cancel: string;
|
|
23
|
+
close: string;
|
|
24
|
+
search: string;
|
|
25
|
+
reset: string;
|
|
26
|
+
all: string;
|
|
27
|
+
noData: string;
|
|
28
|
+
loading: string;
|
|
29
|
+
save: string;
|
|
30
|
+
};
|
|
31
|
+
pagination: {
|
|
32
|
+
/** Text before the count, e.g. "共 " (en: ""). The count renders in its
|
|
33
|
+
* own <span> between prefix and suffix so per-language word order works. */
|
|
34
|
+
totalPrefix: string;
|
|
35
|
+
/** Text after the count, e.g. " 条" (en: " items"). */
|
|
36
|
+
totalSuffix: string;
|
|
37
|
+
};
|
|
38
|
+
datePicker: {
|
|
39
|
+
placeholder: string;
|
|
40
|
+
/** e.g. "2026年" / "2026" */
|
|
41
|
+
year: (year: number | string) => string;
|
|
42
|
+
/** e.g. "6月" / "Jun" */
|
|
43
|
+
month: (month: number | string) => string;
|
|
44
|
+
hour: string;
|
|
45
|
+
minute: string;
|
|
46
|
+
second: string;
|
|
47
|
+
confirm: string;
|
|
48
|
+
/** 7 entries, Sun→Sat ordering as rendered in the calendar header. */
|
|
49
|
+
weekNames: readonly [string, string, string, string, string, string, string];
|
|
50
|
+
/** 12 entries, Jan→Dec. */
|
|
51
|
+
monthNames: readonly [
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
string,
|
|
56
|
+
string,
|
|
57
|
+
string,
|
|
58
|
+
string,
|
|
59
|
+
string,
|
|
60
|
+
string,
|
|
61
|
+
string,
|
|
62
|
+
string,
|
|
63
|
+
string
|
|
64
|
+
];
|
|
65
|
+
};
|
|
66
|
+
timePicker: {
|
|
67
|
+
placeholder: string;
|
|
68
|
+
hour: string;
|
|
69
|
+
minute: string;
|
|
70
|
+
second: string;
|
|
71
|
+
};
|
|
72
|
+
select: {
|
|
73
|
+
placeholder: string;
|
|
74
|
+
clear: string;
|
|
75
|
+
noData: string;
|
|
76
|
+
loading: string;
|
|
77
|
+
};
|
|
78
|
+
autoComplete: {
|
|
79
|
+
placeholder: string;
|
|
80
|
+
loading: string;
|
|
81
|
+
clear: string;
|
|
82
|
+
noData: string;
|
|
83
|
+
};
|
|
84
|
+
cascader: {
|
|
85
|
+
placeholder: string;
|
|
86
|
+
noMatch: string;
|
|
87
|
+
};
|
|
88
|
+
image: {
|
|
89
|
+
loadError: string;
|
|
90
|
+
zoomOut: string;
|
|
91
|
+
zoomIn: string;
|
|
92
|
+
rotate: string;
|
|
93
|
+
close: string;
|
|
94
|
+
};
|
|
95
|
+
transfer: {
|
|
96
|
+
sourceTitle: string;
|
|
97
|
+
targetTitle: string;
|
|
98
|
+
noData: string;
|
|
99
|
+
filterPlaceholder: string;
|
|
100
|
+
};
|
|
101
|
+
empty: {
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
/** Accessibility labels (screen-reader / title text). */
|
|
105
|
+
a11y: {
|
|
106
|
+
rate: string;
|
|
107
|
+
tagClose: string;
|
|
108
|
+
anchorNav: string;
|
|
109
|
+
backTop: string;
|
|
110
|
+
carouselPrev: string;
|
|
111
|
+
carouselNext: string;
|
|
112
|
+
toLightMode: string;
|
|
113
|
+
toDarkMode: string;
|
|
114
|
+
expandSider: string;
|
|
115
|
+
collapseSider: string;
|
|
116
|
+
};
|
|
117
|
+
upload: {
|
|
118
|
+
trigger: string;
|
|
119
|
+
triggerSimple: string;
|
|
120
|
+
/** e.g. 文件 "a.png" 超过大小限制(最大 2MB) */
|
|
121
|
+
oversize: (name: string, max?: string) => string;
|
|
122
|
+
uploadFailed: string;
|
|
123
|
+
statusWaiting: string;
|
|
124
|
+
statusUploading: string;
|
|
125
|
+
statusDone: string;
|
|
126
|
+
statusFailed: string;
|
|
127
|
+
};
|
|
128
|
+
searchTable: {
|
|
129
|
+
search: string;
|
|
130
|
+
reset: string;
|
|
131
|
+
};
|
|
132
|
+
editableTable: {
|
|
133
|
+
summary: string;
|
|
134
|
+
addRow: string;
|
|
135
|
+
addFirstRow: string;
|
|
136
|
+
confirmDelete: string;
|
|
137
|
+
delete: string;
|
|
138
|
+
cancel: string;
|
|
139
|
+
noData: string;
|
|
140
|
+
};
|
|
141
|
+
formPage: {
|
|
142
|
+
loading: string;
|
|
143
|
+
cancel: string;
|
|
144
|
+
saveDraft: string;
|
|
145
|
+
save: string;
|
|
146
|
+
saving: string;
|
|
147
|
+
submit: string;
|
|
148
|
+
submitting: string;
|
|
149
|
+
basicInfo: string;
|
|
150
|
+
/** e.g. "编辑订单" / "Edit Order" */
|
|
151
|
+
editTitle: (title: string) => string;
|
|
152
|
+
/** e.g. "新建订单" / "New Order" */
|
|
153
|
+
createTitle: (title: string) => string;
|
|
154
|
+
};
|
|
155
|
+
approvalDialog: {
|
|
156
|
+
submitTitle: string;
|
|
157
|
+
submitConfirm: string;
|
|
158
|
+
approveTitle: string;
|
|
159
|
+
approveConfirm: string;
|
|
160
|
+
rejectTitle: string;
|
|
161
|
+
rejectConfirm: string;
|
|
162
|
+
rejectPlaceholder: string;
|
|
163
|
+
remarkPlaceholder: string;
|
|
164
|
+
required: string;
|
|
165
|
+
cancel: string;
|
|
166
|
+
processing: string;
|
|
167
|
+
};
|
|
168
|
+
crudPage: {
|
|
169
|
+
all: string;
|
|
170
|
+
/** e.g. "请输入名称" / "Enter Name" */
|
|
171
|
+
fieldPlaceholder: (label: string) => string;
|
|
172
|
+
};
|
|
173
|
+
login: {
|
|
174
|
+
username: string;
|
|
175
|
+
usernamePlaceholder: string;
|
|
176
|
+
password: string;
|
|
177
|
+
passwordPlaceholder: string;
|
|
178
|
+
remember: string;
|
|
179
|
+
login: string;
|
|
180
|
+
loggingIn: string;
|
|
181
|
+
};
|
|
182
|
+
form: {
|
|
183
|
+
inputPlaceholder: (label: string) => string;
|
|
184
|
+
selectPlaceholder: (label: string) => string;
|
|
185
|
+
};
|
|
186
|
+
routes: {
|
|
187
|
+
createSuffix: string;
|
|
188
|
+
editSuffix: string;
|
|
189
|
+
detailSuffix: string;
|
|
190
|
+
};
|
|
191
|
+
/** User-facing request / error feedback (dev-only throws stay hardcoded). */
|
|
192
|
+
request: {
|
|
193
|
+
success: string;
|
|
194
|
+
opFailed: string;
|
|
195
|
+
failed: string;
|
|
196
|
+
failedWithStatus: (status: number | string) => string;
|
|
197
|
+
failedWithMsg: (msg: string) => string;
|
|
198
|
+
timeout: string;
|
|
199
|
+
timeoutRetry: string;
|
|
200
|
+
canceled: string;
|
|
201
|
+
permissionDenied: string;
|
|
202
|
+
invalidUrl: (url: string) => string;
|
|
203
|
+
decodeFailed: (reason: string) => string;
|
|
204
|
+
parseFailed: string;
|
|
205
|
+
networkError: string;
|
|
206
|
+
networkException: string;
|
|
207
|
+
unknownError: (error: string) => string;
|
|
208
|
+
unknown: string;
|
|
209
|
+
uploadFailed: string;
|
|
210
|
+
uploadCanceled: string;
|
|
211
|
+
};
|
|
212
|
+
aiChat: {
|
|
213
|
+
inputPlaceholder: string;
|
|
214
|
+
send: string;
|
|
215
|
+
/** e.g. "对话 3" / "Chat 3" */
|
|
216
|
+
defaultTitle: (n: number) => string;
|
|
217
|
+
phaseTyping: string;
|
|
218
|
+
phaseThinking: string;
|
|
219
|
+
phaseReplying: string;
|
|
220
|
+
phaseSending: string;
|
|
221
|
+
};
|
|
222
|
+
}
|
package/index.ts
CHANGED
|
@@ -71,3 +71,13 @@ export * from './components/base/affix';
|
|
|
71
71
|
export * from './components/base/anchor';
|
|
72
72
|
|
|
73
73
|
export * from './compositions/overlay';
|
|
74
|
+
|
|
75
|
+
// i18n / locale
|
|
76
|
+
export * from './locale';
|
|
77
|
+
export {
|
|
78
|
+
useLocale,
|
|
79
|
+
KINE_LOCALE_KEY,
|
|
80
|
+
setActiveLocaleMessages,
|
|
81
|
+
getActiveLocaleMessages,
|
|
82
|
+
type KineLocaleConfig,
|
|
83
|
+
} from './compositions/common/useLocale';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4c9b1c27-b707-4b0b-98d7-fde5d511ce47
|
package/locale/en.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description English (en) language pack.
|
|
3
|
+
* @author kine-design
|
|
4
|
+
* @version v1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import type { KineLocaleMessages } from './types';
|
|
7
|
+
|
|
8
|
+
const en: KineLocaleMessages = {
|
|
9
|
+
common: {
|
|
10
|
+
confirm: 'OK',
|
|
11
|
+
cancel: 'Cancel',
|
|
12
|
+
close: 'Close',
|
|
13
|
+
search: 'Search',
|
|
14
|
+
reset: 'Reset',
|
|
15
|
+
all: 'All',
|
|
16
|
+
noData: 'No data',
|
|
17
|
+
loading: 'Loading...',
|
|
18
|
+
save: 'Save',
|
|
19
|
+
},
|
|
20
|
+
pagination: {
|
|
21
|
+
totalPrefix: '',
|
|
22
|
+
totalSuffix: ' items',
|
|
23
|
+
},
|
|
24
|
+
datePicker: {
|
|
25
|
+
placeholder: 'Select date...',
|
|
26
|
+
year: (year) => `${year}`,
|
|
27
|
+
month: (month) => `${month}`,
|
|
28
|
+
hour: 'Hour',
|
|
29
|
+
minute: 'Min',
|
|
30
|
+
second: 'Sec',
|
|
31
|
+
confirm: 'OK',
|
|
32
|
+
weekNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
33
|
+
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
34
|
+
},
|
|
35
|
+
timePicker: {
|
|
36
|
+
placeholder: 'Select time...',
|
|
37
|
+
hour: 'Hour',
|
|
38
|
+
minute: 'Min',
|
|
39
|
+
second: 'Sec',
|
|
40
|
+
},
|
|
41
|
+
select: {
|
|
42
|
+
placeholder: 'Select...',
|
|
43
|
+
clear: 'Clear',
|
|
44
|
+
noData: 'No data',
|
|
45
|
+
loading: 'Loading...',
|
|
46
|
+
},
|
|
47
|
+
autoComplete: {
|
|
48
|
+
placeholder: 'Enter...',
|
|
49
|
+
loading: 'Loading',
|
|
50
|
+
clear: 'Clear',
|
|
51
|
+
noData: 'No suggestions',
|
|
52
|
+
},
|
|
53
|
+
cascader: {
|
|
54
|
+
placeholder: 'Select',
|
|
55
|
+
noMatch: 'No matching data',
|
|
56
|
+
},
|
|
57
|
+
image: {
|
|
58
|
+
loadError: 'Load failed',
|
|
59
|
+
zoomOut: 'Zoom out',
|
|
60
|
+
zoomIn: 'Zoom in',
|
|
61
|
+
rotate: 'Rotate',
|
|
62
|
+
close: 'Close',
|
|
63
|
+
},
|
|
64
|
+
transfer: {
|
|
65
|
+
sourceTitle: 'Source',
|
|
66
|
+
targetTitle: 'Target',
|
|
67
|
+
noData: 'No data',
|
|
68
|
+
filterPlaceholder: 'Search...',
|
|
69
|
+
},
|
|
70
|
+
empty: {
|
|
71
|
+
description: 'No data',
|
|
72
|
+
},
|
|
73
|
+
a11y: {
|
|
74
|
+
rate: 'Rating',
|
|
75
|
+
tagClose: 'Close',
|
|
76
|
+
anchorNav: 'Anchor navigation',
|
|
77
|
+
backTop: 'Back to top',
|
|
78
|
+
carouselPrev: 'Previous',
|
|
79
|
+
carouselNext: 'Next',
|
|
80
|
+
toLightMode: 'Switch to light mode',
|
|
81
|
+
toDarkMode: 'Switch to dark mode',
|
|
82
|
+
expandSider: 'Expand sidebar',
|
|
83
|
+
collapseSider: 'Collapse sidebar',
|
|
84
|
+
},
|
|
85
|
+
upload: {
|
|
86
|
+
trigger: 'Click or drag file here to upload',
|
|
87
|
+
triggerSimple: 'Click to upload',
|
|
88
|
+
oversize: (name, max) =>
|
|
89
|
+
max ? `File "${name}" exceeds size limit (max ${max})` : `File "${name}" exceeds size limit`,
|
|
90
|
+
uploadFailed: 'Upload failed',
|
|
91
|
+
statusWaiting: 'Waiting',
|
|
92
|
+
statusUploading: 'Uploading',
|
|
93
|
+
statusDone: 'Done',
|
|
94
|
+
statusFailed: 'Failed',
|
|
95
|
+
},
|
|
96
|
+
searchTable: {
|
|
97
|
+
search: 'Search',
|
|
98
|
+
reset: 'Reset',
|
|
99
|
+
},
|
|
100
|
+
editableTable: {
|
|
101
|
+
summary: 'Total',
|
|
102
|
+
addRow: '+ Add row',
|
|
103
|
+
addFirstRow: 'Add first row',
|
|
104
|
+
confirmDelete: 'Delete this row?',
|
|
105
|
+
delete: 'Delete',
|
|
106
|
+
cancel: 'Cancel',
|
|
107
|
+
noData: 'No data',
|
|
108
|
+
},
|
|
109
|
+
formPage: {
|
|
110
|
+
loading: 'Loading...',
|
|
111
|
+
cancel: 'Cancel',
|
|
112
|
+
saveDraft: 'Save draft',
|
|
113
|
+
save: 'Save',
|
|
114
|
+
saving: 'Saving...',
|
|
115
|
+
submit: 'Submit',
|
|
116
|
+
submitting: 'Submitting...',
|
|
117
|
+
basicInfo: 'Basic info',
|
|
118
|
+
editTitle: (title) => `Edit ${title}`,
|
|
119
|
+
createTitle: (title) => `New ${title}`,
|
|
120
|
+
},
|
|
121
|
+
approvalDialog: {
|
|
122
|
+
submitTitle: 'Submit for approval',
|
|
123
|
+
submitConfirm: 'Confirm submission',
|
|
124
|
+
approveTitle: 'Approve',
|
|
125
|
+
approveConfirm: 'Confirm approval',
|
|
126
|
+
rejectTitle: 'Reject',
|
|
127
|
+
rejectConfirm: 'Confirm rejection',
|
|
128
|
+
rejectPlaceholder: 'Enter rejection reason...',
|
|
129
|
+
remarkPlaceholder: 'Add remark (optional)...',
|
|
130
|
+
required: '* Required',
|
|
131
|
+
cancel: 'Cancel',
|
|
132
|
+
processing: 'Processing...',
|
|
133
|
+
},
|
|
134
|
+
crudPage: {
|
|
135
|
+
all: 'All',
|
|
136
|
+
fieldPlaceholder: (label) => `Enter ${label}`,
|
|
137
|
+
},
|
|
138
|
+
login: {
|
|
139
|
+
username: 'Username',
|
|
140
|
+
usernamePlaceholder: 'Enter username',
|
|
141
|
+
password: 'Password',
|
|
142
|
+
passwordPlaceholder: 'Enter password',
|
|
143
|
+
remember: 'Remember me',
|
|
144
|
+
login: 'Log in',
|
|
145
|
+
loggingIn: 'Logging in...',
|
|
146
|
+
},
|
|
147
|
+
form: {
|
|
148
|
+
inputPlaceholder: (label) => `Enter ${label}`,
|
|
149
|
+
selectPlaceholder: (label) => `Select ${label}`,
|
|
150
|
+
},
|
|
151
|
+
routes: {
|
|
152
|
+
createSuffix: ' - New',
|
|
153
|
+
editSuffix: ' - Edit',
|
|
154
|
+
detailSuffix: ' - Details',
|
|
155
|
+
},
|
|
156
|
+
request: {
|
|
157
|
+
success: 'Success',
|
|
158
|
+
opFailed: 'Operation failed',
|
|
159
|
+
failed: 'Request failed',
|
|
160
|
+
failedWithStatus: (status) => `Request failed (${status})`,
|
|
161
|
+
failedWithMsg: (msg) => `Request failed: ${msg}`,
|
|
162
|
+
timeout: 'Request timed out',
|
|
163
|
+
timeoutRetry: 'Request timed out, please try again',
|
|
164
|
+
canceled: 'Request canceled',
|
|
165
|
+
permissionDenied: 'Permission denied',
|
|
166
|
+
invalidUrl: (url) => `Invalid request URL: ${url}`,
|
|
167
|
+
decodeFailed: (reason) => `Decode failed: ${reason}`,
|
|
168
|
+
parseFailed: 'Failed to parse data',
|
|
169
|
+
networkError: 'Network error',
|
|
170
|
+
networkException: 'Network error, please check your connection',
|
|
171
|
+
unknownError: (error) => `Unknown error: ${error}`,
|
|
172
|
+
unknown: 'An unknown error occurred',
|
|
173
|
+
uploadFailed: 'Upload failed',
|
|
174
|
+
uploadCanceled: 'Upload canceled',
|
|
175
|
+
},
|
|
176
|
+
aiChat: {
|
|
177
|
+
inputPlaceholder: 'Type a message…',
|
|
178
|
+
send: 'Send',
|
|
179
|
+
defaultTitle: (n) => `Chat ${n}`,
|
|
180
|
+
phaseTyping: 'Typing…',
|
|
181
|
+
phaseThinking: 'Thinking…',
|
|
182
|
+
phaseReplying: 'Replying…',
|
|
183
|
+
phaseSending: 'Sending…',
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export default en;
|
package/locale/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description kine-design locale entry — built-in language packs + types.
|
|
3
|
+
*
|
|
4
|
+
* The library ships only the two general languages (zh / en). To use another
|
|
5
|
+
* language, build a full dictionary that satisfies `KineLocaleMessages` in the
|
|
6
|
+
* consuming app and pass it straight to the provider:
|
|
7
|
+
*
|
|
8
|
+
* import type { KineLocaleMessages } from '@kine-design/core';
|
|
9
|
+
* const bn: KineLocaleMessages = { ...full Bengali dictionary... };
|
|
10
|
+
* // <KConfigProvider :locale="bn"> ... </KConfigProvider>
|
|
11
|
+
*
|
|
12
|
+
* TypeScript enforces full key coverage, so a partial/forgotten key is a
|
|
13
|
+
* compile error in the app — the same guarantee the built-in packs enjoy.
|
|
14
|
+
* @author kine-design
|
|
15
|
+
* @version v1.0.0
|
|
16
|
+
*/
|
|
17
|
+
import zh from './zh';
|
|
18
|
+
import en from './en';
|
|
19
|
+
import type { KineLocaleName, KineLocaleMessages } from './types';
|
|
20
|
+
|
|
21
|
+
export type { KineLocaleName, KineLocaleMessages };
|
|
22
|
+
|
|
23
|
+
/** Built-in language packs, keyed by locale name. */
|
|
24
|
+
export const locales: Record<KineLocaleName, KineLocaleMessages> = { zh, en };
|
|
25
|
+
|
|
26
|
+
/** Fallback locale used when none is provided / an unknown name is passed. */
|
|
27
|
+
export const DEFAULT_LOCALE: KineLocaleName = 'zh';
|
|
28
|
+
|
|
29
|
+
export { zh, en };
|
package/locale/types.ts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description kine-design locale message contract.
|
|
3
|
+
* The single source of truth for every user-facing string in the component
|
|
4
|
+
* library. Each language pack (zh / en) must implement this interface in
|
|
5
|
+
* full — a missing key is a compile error, which is exactly the guarantee we
|
|
6
|
+
* want so translations never silently drift out of sync.
|
|
7
|
+
* @author kine-design
|
|
8
|
+
* @version v1.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Built-in language pack identifiers. The library ships only the two general
|
|
13
|
+
* languages (zh / en). App-specific languages — e.g. Bengali in the factory —
|
|
14
|
+
* are supplied by the consumer as a full `KineLocaleMessages` object passed to
|
|
15
|
+
* `<KConfigProvider :locale="...">`, not bundled here.
|
|
16
|
+
*/
|
|
17
|
+
export type KineLocaleName = 'zh' | 'en';
|
|
18
|
+
|
|
19
|
+
/** Full message dictionary consumed by components via `useLocale()`. */
|
|
20
|
+
export interface KineLocaleMessages {
|
|
21
|
+
/** Shared atoms reused across many components. */
|
|
22
|
+
common: {
|
|
23
|
+
confirm: string;
|
|
24
|
+
cancel: string;
|
|
25
|
+
close: string;
|
|
26
|
+
search: string;
|
|
27
|
+
reset: string;
|
|
28
|
+
all: string;
|
|
29
|
+
noData: string;
|
|
30
|
+
loading: string;
|
|
31
|
+
save: string;
|
|
32
|
+
};
|
|
33
|
+
pagination: {
|
|
34
|
+
/** Text before the count, e.g. "共 " (en: ""). The count renders in its
|
|
35
|
+
* own <span> between prefix and suffix so per-language word order works. */
|
|
36
|
+
totalPrefix: string;
|
|
37
|
+
/** Text after the count, e.g. " 条" (en: " items"). */
|
|
38
|
+
totalSuffix: string;
|
|
39
|
+
};
|
|
40
|
+
datePicker: {
|
|
41
|
+
placeholder: string;
|
|
42
|
+
/** e.g. "2026年" / "2026" */
|
|
43
|
+
year: (year: number | string) => string;
|
|
44
|
+
/** e.g. "6月" / "Jun" */
|
|
45
|
+
month: (month: number | string) => string;
|
|
46
|
+
hour: string;
|
|
47
|
+
minute: string;
|
|
48
|
+
second: string;
|
|
49
|
+
confirm: string;
|
|
50
|
+
/** 7 entries, Sun→Sat ordering as rendered in the calendar header. */
|
|
51
|
+
weekNames: readonly [string, string, string, string, string, string, string];
|
|
52
|
+
/** 12 entries, Jan→Dec. */
|
|
53
|
+
monthNames: readonly [
|
|
54
|
+
string, string, string, string, string, string,
|
|
55
|
+
string, string, string, string, string, string,
|
|
56
|
+
];
|
|
57
|
+
};
|
|
58
|
+
timePicker: {
|
|
59
|
+
placeholder: string;
|
|
60
|
+
hour: string;
|
|
61
|
+
minute: string;
|
|
62
|
+
second: string;
|
|
63
|
+
};
|
|
64
|
+
select: {
|
|
65
|
+
placeholder: string;
|
|
66
|
+
clear: string;
|
|
67
|
+
noData: string;
|
|
68
|
+
loading: string;
|
|
69
|
+
};
|
|
70
|
+
autoComplete: {
|
|
71
|
+
placeholder: string;
|
|
72
|
+
loading: string;
|
|
73
|
+
clear: string;
|
|
74
|
+
noData: string;
|
|
75
|
+
};
|
|
76
|
+
cascader: {
|
|
77
|
+
placeholder: string;
|
|
78
|
+
noMatch: string;
|
|
79
|
+
};
|
|
80
|
+
image: {
|
|
81
|
+
loadError: string;
|
|
82
|
+
zoomOut: string;
|
|
83
|
+
zoomIn: string;
|
|
84
|
+
rotate: string;
|
|
85
|
+
close: string;
|
|
86
|
+
};
|
|
87
|
+
transfer: {
|
|
88
|
+
sourceTitle: string;
|
|
89
|
+
targetTitle: string;
|
|
90
|
+
noData: string;
|
|
91
|
+
filterPlaceholder: string;
|
|
92
|
+
};
|
|
93
|
+
empty: {
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
/** Accessibility labels (screen-reader / title text). */
|
|
97
|
+
a11y: {
|
|
98
|
+
rate: string;
|
|
99
|
+
tagClose: string;
|
|
100
|
+
anchorNav: string;
|
|
101
|
+
backTop: string;
|
|
102
|
+
carouselPrev: string;
|
|
103
|
+
carouselNext: string;
|
|
104
|
+
toLightMode: string;
|
|
105
|
+
toDarkMode: string;
|
|
106
|
+
expandSider: string;
|
|
107
|
+
collapseSider: string;
|
|
108
|
+
};
|
|
109
|
+
upload: {
|
|
110
|
+
trigger: string;
|
|
111
|
+
triggerSimple: string;
|
|
112
|
+
/** e.g. 文件 "a.png" 超过大小限制(最大 2MB) */
|
|
113
|
+
oversize: (name: string, max?: string) => string;
|
|
114
|
+
uploadFailed: string;
|
|
115
|
+
statusWaiting: string;
|
|
116
|
+
statusUploading: string;
|
|
117
|
+
statusDone: string;
|
|
118
|
+
statusFailed: string;
|
|
119
|
+
};
|
|
120
|
+
searchTable: {
|
|
121
|
+
search: string;
|
|
122
|
+
reset: string;
|
|
123
|
+
};
|
|
124
|
+
editableTable: {
|
|
125
|
+
summary: string;
|
|
126
|
+
addRow: string;
|
|
127
|
+
addFirstRow: string;
|
|
128
|
+
confirmDelete: string;
|
|
129
|
+
delete: string;
|
|
130
|
+
cancel: string;
|
|
131
|
+
noData: string;
|
|
132
|
+
};
|
|
133
|
+
formPage: {
|
|
134
|
+
loading: string;
|
|
135
|
+
cancel: string;
|
|
136
|
+
saveDraft: string;
|
|
137
|
+
save: string;
|
|
138
|
+
saving: string;
|
|
139
|
+
submit: string;
|
|
140
|
+
submitting: string;
|
|
141
|
+
basicInfo: string;
|
|
142
|
+
/** e.g. "编辑订单" / "Edit Order" */
|
|
143
|
+
editTitle: (title: string) => string;
|
|
144
|
+
/** e.g. "新建订单" / "New Order" */
|
|
145
|
+
createTitle: (title: string) => string;
|
|
146
|
+
};
|
|
147
|
+
approvalDialog: {
|
|
148
|
+
submitTitle: string;
|
|
149
|
+
submitConfirm: string;
|
|
150
|
+
approveTitle: string;
|
|
151
|
+
approveConfirm: string;
|
|
152
|
+
rejectTitle: string;
|
|
153
|
+
rejectConfirm: string;
|
|
154
|
+
rejectPlaceholder: string;
|
|
155
|
+
remarkPlaceholder: string;
|
|
156
|
+
required: string;
|
|
157
|
+
cancel: string;
|
|
158
|
+
processing: string;
|
|
159
|
+
};
|
|
160
|
+
crudPage: {
|
|
161
|
+
all: string;
|
|
162
|
+
/** e.g. "请输入名称" / "Enter Name" */
|
|
163
|
+
fieldPlaceholder: (label: string) => string;
|
|
164
|
+
};
|
|
165
|
+
login: {
|
|
166
|
+
username: string;
|
|
167
|
+
usernamePlaceholder: string;
|
|
168
|
+
password: string;
|
|
169
|
+
passwordPlaceholder: string;
|
|
170
|
+
remember: string;
|
|
171
|
+
login: string;
|
|
172
|
+
loggingIn: string;
|
|
173
|
+
};
|
|
174
|
+
form: {
|
|
175
|
+
inputPlaceholder: (label: string) => string;
|
|
176
|
+
selectPlaceholder: (label: string) => string;
|
|
177
|
+
};
|
|
178
|
+
routes: {
|
|
179
|
+
createSuffix: string;
|
|
180
|
+
editSuffix: string;
|
|
181
|
+
detailSuffix: string;
|
|
182
|
+
};
|
|
183
|
+
/** User-facing request / error feedback (dev-only throws stay hardcoded). */
|
|
184
|
+
request: {
|
|
185
|
+
success: string;
|
|
186
|
+
opFailed: string;
|
|
187
|
+
failed: string;
|
|
188
|
+
failedWithStatus: (status: number | string) => string;
|
|
189
|
+
failedWithMsg: (msg: string) => string;
|
|
190
|
+
timeout: string;
|
|
191
|
+
timeoutRetry: string;
|
|
192
|
+
canceled: string;
|
|
193
|
+
permissionDenied: string;
|
|
194
|
+
invalidUrl: (url: string) => string;
|
|
195
|
+
decodeFailed: (reason: string) => string;
|
|
196
|
+
parseFailed: string;
|
|
197
|
+
networkError: string;
|
|
198
|
+
networkException: string;
|
|
199
|
+
unknownError: (error: string) => string;
|
|
200
|
+
unknown: string;
|
|
201
|
+
uploadFailed: string;
|
|
202
|
+
uploadCanceled: string;
|
|
203
|
+
};
|
|
204
|
+
aiChat: {
|
|
205
|
+
inputPlaceholder: string;
|
|
206
|
+
send: string;
|
|
207
|
+
/** e.g. "对话 3" / "Chat 3" */
|
|
208
|
+
defaultTitle: (n: number) => string;
|
|
209
|
+
phaseTyping: string;
|
|
210
|
+
phaseThinking: string;
|
|
211
|
+
phaseReplying: string;
|
|
212
|
+
phaseSending: string;
|
|
213
|
+
};
|
|
214
|
+
}
|