@apollo-design/locale 0.0.0-stage → 0.1.9
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 +86 -2
- package/dist/confirm-locale.mjs +53 -0
- package/dist/context.mjs +3 -0
- package/dist/index.d.mts +564 -0
- package/dist/index.d.ts +564 -0
- package/dist/index.mjs +77 -0
- package/dist/locale-provider.mjs +38 -0
- package/dist/locales/ar_EG.mjs +281 -0
- package/dist/locales/az_AZ.mjs +248 -0
- package/dist/locales/bg_BG.mjs +249 -0
- package/dist/locales/bn_BD.mjs +245 -0
- package/dist/locales/by_BY.mjs +247 -0
- package/dist/locales/ca_ES.mjs +249 -0
- package/dist/locales/cs_CZ.mjs +249 -0
- package/dist/locales/da_DK.mjs +249 -0
- package/dist/locales/de_DE.mjs +283 -0
- package/dist/locales/el_GR.mjs +249 -0
- package/dist/locales/en_GB.mjs +249 -0
- package/dist/locales/en_US.mjs +252 -0
- package/dist/locales/es_ES.mjs +279 -0
- package/dist/locales/es_US.mjs +279 -0
- package/dist/locales/et_EE.mjs +233 -0
- package/dist/locales/eu_ES.mjs +231 -0
- package/dist/locales/fa_IR.mjs +249 -0
- package/dist/locales/fi_FI.mjs +249 -0
- package/dist/locales/fr_BE.mjs +249 -0
- package/dist/locales/fr_CA.mjs +249 -0
- package/dist/locales/fr_FR.mjs +249 -0
- package/dist/locales/ga_IE.mjs +245 -0
- package/dist/locales/gl_ES.mjs +249 -0
- package/dist/locales/he_IL.mjs +251 -0
- package/dist/locales/hi_IN.mjs +251 -0
- package/dist/locales/hr_HR.mjs +251 -0
- package/dist/locales/hu_HU.mjs +249 -0
- package/dist/locales/hy_AM.mjs +225 -0
- package/dist/locales/id_ID.mjs +251 -0
- package/dist/locales/is_IS.mjs +229 -0
- package/dist/locales/it_IT.mjs +279 -0
- package/dist/locales/ja_JP.mjs +255 -0
- package/dist/locales/ka_GE.mjs +245 -0
- package/dist/locales/kk_KZ.mjs +243 -0
- package/dist/locales/km_KH.mjs +245 -0
- package/dist/locales/kmr_IQ.mjs +229 -0
- package/dist/locales/kn_IN.mjs +248 -0
- package/dist/locales/ko_KR.mjs +253 -0
- package/dist/locales/ku_IQ.mjs +229 -0
- package/dist/locales/lt_LT.mjs +251 -0
- package/dist/locales/lv_LV.mjs +233 -0
- package/dist/locales/mk_MK.mjs +229 -0
- package/dist/locales/ml_IN.mjs +245 -0
- package/dist/locales/mn_MN.mjs +231 -0
- package/dist/locales/mr_IN.mjs +283 -0
- package/dist/locales/ms_MY.mjs +252 -0
- package/dist/locales/my_MM.mjs +247 -0
- package/dist/locales/nb_NO.mjs +250 -0
- package/dist/locales/ne_NP.mjs +247 -0
- package/dist/locales/nl_BE.mjs +249 -0
- package/dist/locales/nl_NL.mjs +249 -0
- package/dist/locales/pl_PL.mjs +281 -0
- package/dist/locales/pt_BR.mjs +279 -0
- package/dist/locales/pt_PT.mjs +281 -0
- package/dist/locales/ro_RO.mjs +251 -0
- package/dist/locales/ru_RU.mjs +279 -0
- package/dist/locales/si_LK.mjs +247 -0
- package/dist/locales/sk_SK.mjs +249 -0
- package/dist/locales/sl_SI.mjs +231 -0
- package/dist/locales/sq_AL.mjs +282 -0
- package/dist/locales/sr_RS.mjs +248 -0
- package/dist/locales/sv_SE.mjs +249 -0
- package/dist/locales/ta_IN.mjs +246 -0
- package/dist/locales/th_TH.mjs +249 -0
- package/dist/locales/tk_TK.mjs +245 -0
- package/dist/locales/tr_TR.mjs +279 -0
- package/dist/locales/uk_UA.mjs +279 -0
- package/dist/locales/ur_PK.mjs +245 -0
- package/dist/locales/uz_UZ.mjs +245 -0
- package/dist/locales/vi_VN.mjs +281 -0
- package/dist/locales/zh_CN.mjs +254 -0
- package/dist/locales/zh_HK.mjs +253 -0
- package/dist/locales/zh_TW.mjs +253 -0
- package/dist/use-locale.mjs +25 -0
- package/package.json +29 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { VNodeChild, MaybeRefOrGetter, InjectionKey, PropType, SlotsType, ComputedRef } from 'vue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@apollo-design/locale` 的类型契约。
|
|
6
|
+
*
|
|
7
|
+
* 逐字段对齐 antd 6.6.4 的 `es/locale/index.d.ts` 与各分片的 `.d.ts`:
|
|
8
|
+
* `pagination/Pagination.d.ts` / `date-picker/generatePicker/interface.d.ts` /
|
|
9
|
+
* `table/interface.d.ts` / `modal/interface.d.ts` / `tour/interface.d.ts` /
|
|
10
|
+
* `popconfirm/PurePanel.d.ts` / `transfer/index.d.ts` / `upload/interface.d.ts` /
|
|
11
|
+
* `empty/index.d.ts` / `time-picker/index.d.ts`。
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ **两处类型不能照抄上游的 import 路径**:
|
|
14
|
+
* - `PaginationLocale` 上游从 `@rc-component/pagination` 引,
|
|
15
|
+
* - `PickerLocale.lang` 上游从 `@rc-component/picker/interface` 引。
|
|
16
|
+
* 本包 `dependsOn: []`,**不依赖任何 rc 包**,所以这两个接口按
|
|
17
|
+
* 「我们实际发布的数据形状」**结构化重写**。字段集是从固化数据里探出来的
|
|
18
|
+
* (见契约文档 §2 与 §9 第 4 条)—— 不是凭记忆写的。
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ 上游用 `React.ReactNode` 的地方这里用 Vue 的 `VNodeChild`,
|
|
21
|
+
* 保持「可以传节点」的表达力(消费方从 antd 迁过来时不会因为类型太窄而报错)。
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 分页的语言数据。11 个字段,**全部是 string**。
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ 字段名是 `snake_case`(`items_per_page` / `prev_5`),与 antd 其它分片的
|
|
28
|
+
* `camelCase` 不一致 —— 这是 rc-pagination 的既有形状,照抄。
|
|
29
|
+
*/
|
|
30
|
+
interface PaginationLocale {
|
|
31
|
+
items_per_page: string;
|
|
32
|
+
jump_to: string;
|
|
33
|
+
/** ⚠️ 部分语言没有(实测 73 个包里 71 个有) */
|
|
34
|
+
jump_to_confirm?: string;
|
|
35
|
+
page: string;
|
|
36
|
+
prev_page: string;
|
|
37
|
+
next_page: string;
|
|
38
|
+
prev_5: string;
|
|
39
|
+
next_5: string;
|
|
40
|
+
prev_3: string;
|
|
41
|
+
next_3: string;
|
|
42
|
+
/** ⚠️ 部分语言没有(实测 73 个包里 71 个有) */
|
|
43
|
+
page_size?: string;
|
|
44
|
+
}
|
|
45
|
+
interface TimePickerLocale {
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
rangePlaceholder?: [string, string];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 日期选择器的 `lang` 部分(上游是 `RcPickerLocale & AdditionalPickerLocaleLangProps`)。
|
|
51
|
+
*
|
|
52
|
+
* ⚠️ 前四个字段(`yearFormat` / `dayFormat` / `cellMeridiemFormat` / `monthBeforeYear`)
|
|
53
|
+
* 来自 rc-picker 的 `commonLocale`,**每个语言包都有**;
|
|
54
|
+
* `shortWeekDays` / `shortMonths` **只有 5 个语言有**(`it_IT` / `mr_IN` / `pt_BR` /
|
|
55
|
+
* `pt_PT` / `tr_TR`),所以是可选的。
|
|
56
|
+
*/
|
|
57
|
+
interface PickerLangLocale {
|
|
58
|
+
yearFormat: string;
|
|
59
|
+
monthBeforeYear: boolean;
|
|
60
|
+
locale: string;
|
|
61
|
+
today: string;
|
|
62
|
+
now: string;
|
|
63
|
+
backToToday: string;
|
|
64
|
+
ok: string;
|
|
65
|
+
clear: string;
|
|
66
|
+
week: string;
|
|
67
|
+
month: string;
|
|
68
|
+
year: string;
|
|
69
|
+
timeSelect: string;
|
|
70
|
+
dateSelect: string;
|
|
71
|
+
monthSelect: string;
|
|
72
|
+
yearSelect: string;
|
|
73
|
+
decadeSelect: string;
|
|
74
|
+
previousMonth: string;
|
|
75
|
+
nextMonth: string;
|
|
76
|
+
previousYear: string;
|
|
77
|
+
nextYear: string;
|
|
78
|
+
previousDecade: string;
|
|
79
|
+
nextDecade: string;
|
|
80
|
+
previousCentury: string;
|
|
81
|
+
nextCentury: string;
|
|
82
|
+
placeholder: string;
|
|
83
|
+
rangePlaceholder: [string, string];
|
|
84
|
+
/** 71/73 */
|
|
85
|
+
dayFormat?: string;
|
|
86
|
+
/** 70/73 */
|
|
87
|
+
cellMeridiemFormat?: string;
|
|
88
|
+
/** 62/73 */
|
|
89
|
+
yearPlaceholder?: string;
|
|
90
|
+
/** 63/73 */
|
|
91
|
+
quarterPlaceholder?: string;
|
|
92
|
+
/** 63/73 */
|
|
93
|
+
monthPlaceholder?: string;
|
|
94
|
+
/** 63/73 */
|
|
95
|
+
weekPlaceholder?: string;
|
|
96
|
+
/** 63/73 */
|
|
97
|
+
rangeYearPlaceholder?: [string, string];
|
|
98
|
+
/** 63/73 */
|
|
99
|
+
rangeMonthPlaceholder?: [string, string];
|
|
100
|
+
/** 55/73 */
|
|
101
|
+
rangeQuarterPlaceholder?: [string, string];
|
|
102
|
+
/** 63/73 */
|
|
103
|
+
rangeWeekPlaceholder?: [string, string];
|
|
104
|
+
/** 33/73 */
|
|
105
|
+
weekSelect?: string;
|
|
106
|
+
/** 16/73(`it_IT` / `mr_IN` / `pt_BR` / `pt_PT` / `tr_TR` 等) */
|
|
107
|
+
shortWeekDays?: string[];
|
|
108
|
+
/** 16/73 */
|
|
109
|
+
shortMonths?: string[];
|
|
110
|
+
/** 5/73 */
|
|
111
|
+
monthFormat?: string;
|
|
112
|
+
/** 4/73 */
|
|
113
|
+
cellDateFormat?: string;
|
|
114
|
+
/** 3/73 */
|
|
115
|
+
fieldDateFormat?: string;
|
|
116
|
+
/** 3/73 */
|
|
117
|
+
fieldDateTimeFormat?: string;
|
|
118
|
+
/** 1/73 */
|
|
119
|
+
fieldMonthFormat?: string;
|
|
120
|
+
/** 1/73 */
|
|
121
|
+
fieldWeekFormat?: string;
|
|
122
|
+
}
|
|
123
|
+
interface PickerLocale {
|
|
124
|
+
lang: PickerLangLocale;
|
|
125
|
+
timePickerLocale: TimePickerLocale;
|
|
126
|
+
/**
|
|
127
|
+
* 下面四个是上游保留的**已废弃**字段(),
|
|
128
|
+
* 官方注释写的是「Invalid, Please use `lang.field*Format` instead」。
|
|
129
|
+
* 本包的 73 个语言包**都没有**它们 —— 列在这里只为让类型与上游同构。
|
|
130
|
+
*/
|
|
131
|
+
/** @deprecated 用 `lang.fieldDateFormat` */
|
|
132
|
+
dateFormat?: string;
|
|
133
|
+
/** @deprecated 用 `lang.fieldDateTimeFormat` */
|
|
134
|
+
dateTimeFormat?: string;
|
|
135
|
+
/** @deprecated 用 `lang.fieldWeekFormat` */
|
|
136
|
+
weekFormat?: string;
|
|
137
|
+
/** @deprecated 用 `lang.fieldWeekFormat` */
|
|
138
|
+
monthFormat?: string;
|
|
139
|
+
}
|
|
140
|
+
interface TableLocale {
|
|
141
|
+
filterTitle?: string;
|
|
142
|
+
filterConfirm?: VNodeChild;
|
|
143
|
+
filterReset?: VNodeChild;
|
|
144
|
+
filterEmptyText?: VNodeChild;
|
|
145
|
+
/** @deprecated 用 `filterCheckAll` */
|
|
146
|
+
filterCheckall?: VNodeChild;
|
|
147
|
+
filterCheckAll?: VNodeChild;
|
|
148
|
+
filterSearchPlaceholder?: string;
|
|
149
|
+
emptyText?: VNodeChild;
|
|
150
|
+
selectAll?: VNodeChild;
|
|
151
|
+
selectNone?: VNodeChild;
|
|
152
|
+
selectInvert?: VNodeChild;
|
|
153
|
+
selectionAll?: VNodeChild;
|
|
154
|
+
sortTitle?: string;
|
|
155
|
+
expand?: string;
|
|
156
|
+
collapse?: string;
|
|
157
|
+
triggerDesc?: string;
|
|
158
|
+
triggerAsc?: string;
|
|
159
|
+
cancelSort?: string;
|
|
160
|
+
}
|
|
161
|
+
interface ModalLocale {
|
|
162
|
+
okText: string;
|
|
163
|
+
cancelText: string;
|
|
164
|
+
justOkText: string;
|
|
165
|
+
}
|
|
166
|
+
interface TourLocale {
|
|
167
|
+
Next: string;
|
|
168
|
+
Previous: string;
|
|
169
|
+
Finish: string;
|
|
170
|
+
}
|
|
171
|
+
interface PopconfirmLocale {
|
|
172
|
+
okText: string;
|
|
173
|
+
cancelText: string;
|
|
174
|
+
}
|
|
175
|
+
interface TransferLocale {
|
|
176
|
+
titles?: VNodeChild[];
|
|
177
|
+
notFoundContent?: VNodeChild | VNodeChild[];
|
|
178
|
+
searchPlaceholder: string;
|
|
179
|
+
itemUnit: string;
|
|
180
|
+
itemsUnit: string;
|
|
181
|
+
remove?: string;
|
|
182
|
+
selectAll?: string;
|
|
183
|
+
deselectAll?: string;
|
|
184
|
+
selectCurrent?: string;
|
|
185
|
+
selectInvert?: string;
|
|
186
|
+
removeAll?: string;
|
|
187
|
+
removeCurrent?: string;
|
|
188
|
+
}
|
|
189
|
+
/** `Empty` 用的是它自己的 `TransferLocale`(同名不同义,只有一个 `description`)。 */
|
|
190
|
+
interface EmptyLocale {
|
|
191
|
+
description: string;
|
|
192
|
+
}
|
|
193
|
+
interface UploadLocale {
|
|
194
|
+
uploading?: string;
|
|
195
|
+
removeFile?: string;
|
|
196
|
+
downloadFile?: string;
|
|
197
|
+
uploadError?: string;
|
|
198
|
+
previewFile?: string;
|
|
199
|
+
}
|
|
200
|
+
/** 所有组件共用的占位/提示文案。 */
|
|
201
|
+
interface GlobalLocale {
|
|
202
|
+
clear?: string;
|
|
203
|
+
placeholder?: string;
|
|
204
|
+
close?: string;
|
|
205
|
+
sortable?: string;
|
|
206
|
+
show?: string;
|
|
207
|
+
hide?: string;
|
|
208
|
+
}
|
|
209
|
+
interface TextLocale {
|
|
210
|
+
edit?: VNodeChild;
|
|
211
|
+
copy?: VNodeChild;
|
|
212
|
+
copied?: VNodeChild;
|
|
213
|
+
expand?: VNodeChild;
|
|
214
|
+
collapse?: VNodeChild;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 表单校验消息模板。
|
|
218
|
+
*
|
|
219
|
+
* 上游来自 `@rc-component/form` 的 `ValidateMessages`。本包按数据形状重写:
|
|
220
|
+
* **所有字段都是可选的**(rc-form 允许局部覆盖),模板串里用 `${label}` / `${min}`
|
|
221
|
+
* 这类占位符。
|
|
222
|
+
*/
|
|
223
|
+
interface ValidateMessages {
|
|
224
|
+
default?: string;
|
|
225
|
+
required?: string;
|
|
226
|
+
enum?: string;
|
|
227
|
+
whitespace?: string;
|
|
228
|
+
date?: {
|
|
229
|
+
format?: string;
|
|
230
|
+
parse?: string;
|
|
231
|
+
invalid?: string;
|
|
232
|
+
};
|
|
233
|
+
types?: {
|
|
234
|
+
string?: string;
|
|
235
|
+
method?: string;
|
|
236
|
+
array?: string;
|
|
237
|
+
object?: string;
|
|
238
|
+
number?: string;
|
|
239
|
+
date?: string;
|
|
240
|
+
boolean?: string;
|
|
241
|
+
integer?: string;
|
|
242
|
+
float?: string;
|
|
243
|
+
regexp?: string;
|
|
244
|
+
email?: string;
|
|
245
|
+
url?: string;
|
|
246
|
+
hex?: string;
|
|
247
|
+
};
|
|
248
|
+
string?: {
|
|
249
|
+
len?: string;
|
|
250
|
+
min?: string;
|
|
251
|
+
max?: string;
|
|
252
|
+
range?: string;
|
|
253
|
+
};
|
|
254
|
+
number?: {
|
|
255
|
+
len?: string;
|
|
256
|
+
min?: string;
|
|
257
|
+
max?: string;
|
|
258
|
+
range?: string;
|
|
259
|
+
};
|
|
260
|
+
array?: {
|
|
261
|
+
len?: string;
|
|
262
|
+
min?: string;
|
|
263
|
+
max?: string;
|
|
264
|
+
range?: string;
|
|
265
|
+
};
|
|
266
|
+
pattern?: {
|
|
267
|
+
mismatch?: string;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
interface FormLocale {
|
|
271
|
+
optional?: string;
|
|
272
|
+
defaultValidateMessages: ValidateMessages;
|
|
273
|
+
}
|
|
274
|
+
interface QRCodeLocale {
|
|
275
|
+
expired?: string;
|
|
276
|
+
refresh?: string;
|
|
277
|
+
scanned?: string;
|
|
278
|
+
}
|
|
279
|
+
interface CarouselLocale {
|
|
280
|
+
prevSlide: string;
|
|
281
|
+
nextSlide: string;
|
|
282
|
+
}
|
|
283
|
+
interface ColorPickerLocale {
|
|
284
|
+
presetEmpty: string;
|
|
285
|
+
transparent: string;
|
|
286
|
+
singleColor: string;
|
|
287
|
+
gradientColor: string;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* 一个语言包。
|
|
291
|
+
*
|
|
292
|
+
* ⚠️ `locale` 是**唯一必填**字段,其余全部可选 —— 这让「只覆盖一部分分片」
|
|
293
|
+
* 成为合法用法(`ConfigProvider` 的 `locale` 就是被这样用的)。
|
|
294
|
+
*
|
|
295
|
+
* ⚠️ 两个容易看错的地方:
|
|
296
|
+
* - `Select` 在类型里存在,但 **75 个语言包一个都没有它** ——
|
|
297
|
+
* 它是留给 `ConfigProvider` 消费方的口子,不是疏漏。
|
|
298
|
+
* - `Carousel` / `ColorPicker` 的子字段是**必填**,与其它分片不同。照抄上游。
|
|
299
|
+
*/
|
|
300
|
+
interface Locale {
|
|
301
|
+
locale: string;
|
|
302
|
+
Pagination?: PaginationLocale;
|
|
303
|
+
DatePicker?: PickerLocale;
|
|
304
|
+
TimePicker?: TimePickerLocale;
|
|
305
|
+
Calendar?: PickerLocale;
|
|
306
|
+
Table?: TableLocale;
|
|
307
|
+
Modal?: ModalLocale;
|
|
308
|
+
Tour?: TourLocale;
|
|
309
|
+
Popconfirm?: PopconfirmLocale;
|
|
310
|
+
Transfer?: TransferLocale;
|
|
311
|
+
Select?: Record<string, unknown>;
|
|
312
|
+
Upload?: UploadLocale;
|
|
313
|
+
Empty?: EmptyLocale;
|
|
314
|
+
global?: GlobalLocale;
|
|
315
|
+
Icon?: Record<string, unknown>;
|
|
316
|
+
Text?: TextLocale;
|
|
317
|
+
Form?: FormLocale;
|
|
318
|
+
QRCode?: QRCodeLocale;
|
|
319
|
+
Carousel?: CarouselLocale;
|
|
320
|
+
ColorPicker?: ColorPickerLocale;
|
|
321
|
+
}
|
|
322
|
+
/** 分片名(`'locale'` 之外的全部键)。 */
|
|
323
|
+
type LocaleComponentName = Exclude<keyof Locale, 'locale'>;
|
|
324
|
+
|
|
325
|
+
/** Ordered global fallback sources for context-free Modal static services. */
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Bind a provider's Modal source during setup. Client mount order determines
|
|
329
|
+
* priority; replacement, deep edits and withdrawal retain that order. An absent
|
|
330
|
+
* source contributes no fields. SSR never registers request-local data.
|
|
331
|
+
*/
|
|
332
|
+
declare function useConfirmLocale(source: MaybeRefOrGetter<ModalLocale | undefined>): void;
|
|
333
|
+
/**
|
|
334
|
+
* 注册一份 Modal locale。
|
|
335
|
+
*
|
|
336
|
+
* @param newLocale `undefined` 时清空全部来源并重置为英文默认值。
|
|
337
|
+
* @returns 反注册函数;`newLocale` 为空时返回 `undefined`
|
|
338
|
+
*/
|
|
339
|
+
declare function changeConfirmLocale(newLocale?: ModalLocale): (() => void) | undefined;
|
|
340
|
+
/** 取当前生效的 Modal locale(`Modal.confirm` 用它)。 */
|
|
341
|
+
declare function getConfirmLocale(): ModalLocale;
|
|
342
|
+
/** 测试辅助:清空全部静态服务来源。生产代码不应调用。 */
|
|
343
|
+
declare function resetConfirmLocale(): void;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* locale 的注入上下文。
|
|
347
|
+
*
|
|
348
|
+
* 契约来源:antd 6.6.4 的 `es/locale/context.js` —— `createContext(undefined)`。
|
|
349
|
+
* 默认值是 `undefined`(**不是空对象**),这一点很重要:`useLocale` 靠
|
|
350
|
+
* 「`fullLocale` 是不是 `undefined`」区分「没挂 Provider」与「挂了但没给这个分片」。
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* context 的值:`Locale` 加上一个 `exist` 标志。
|
|
355
|
+
*
|
|
356
|
+
* ⚠️ `exist` 是 antd 的内部约定(`index.js:28` 的 `{...locale, exist: true}`),
|
|
357
|
+
* 唯一用途是让 `useLocale` 在「挂了 Provider 但没给 `locale` 字段」时
|
|
358
|
+
* 回退到 `'en'`(见 `use-locale.ts`)。
|
|
359
|
+
*/
|
|
360
|
+
/**
|
|
361
|
+
* ⚠️ 是 **Partial** —— `LocaleProvider` 的 `locale` prop 默认值是 `{}`,
|
|
362
|
+
* 注入出去的值就是 `{exist: true}`(没有 `locale` 字段)。
|
|
363
|
+
* 用完整的 `Locale` 会逼得每个只覆盖一个分片的调用方都要编造一个 `locale` 字符串。
|
|
364
|
+
*/
|
|
365
|
+
type LocaleContextValue = Partial<Locale> & {
|
|
366
|
+
exist?: boolean;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* 注入键。
|
|
370
|
+
*
|
|
371
|
+
* ⚠️ 值的形态接受 `ComputedRef` / getter / 普通对象三种 —— `LocaleProvider`
|
|
372
|
+
* 提供的是 `ComputedRef`(这样 `locale` prop 变化能被追踪),但消费方直接
|
|
373
|
+
* `provide` 一个普通对象也应当工作。`useLocale` 内部用 `toValue` 归一。
|
|
374
|
+
*/
|
|
375
|
+
type LocaleContextSource = MaybeRefOrGetter<LocaleContextValue | undefined>;
|
|
376
|
+
declare const localeContextKey: InjectionKey<MaybeRefOrGetter<LocaleContextValue | undefined>>;
|
|
377
|
+
|
|
378
|
+
declare const ANT_MARK = "internalMark";
|
|
379
|
+
/** 测试辅助:清空告警去重表。生产代码不应调用。 */
|
|
380
|
+
declare function resetLocaleWarned(): void;
|
|
381
|
+
declare const LocaleProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
382
|
+
locale: {
|
|
383
|
+
type: PropType<Partial<Locale>>;
|
|
384
|
+
default: () => {};
|
|
385
|
+
};
|
|
386
|
+
/** 上游用它判断「是不是官方导出的那个组件」 */
|
|
387
|
+
_ANT_MARK__: {
|
|
388
|
+
type: StringConstructor;
|
|
389
|
+
default: undefined;
|
|
390
|
+
};
|
|
391
|
+
}>, () => VNodeChild, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
392
|
+
locale: {
|
|
393
|
+
type: PropType<Partial<Locale>>;
|
|
394
|
+
default: () => {};
|
|
395
|
+
};
|
|
396
|
+
/** 上游用它判断「是不是官方导出的那个组件」 */
|
|
397
|
+
_ANT_MARK__: {
|
|
398
|
+
type: StringConstructor;
|
|
399
|
+
default: undefined;
|
|
400
|
+
};
|
|
401
|
+
}>> & Readonly<{}>, {
|
|
402
|
+
locale: Partial<Locale>;
|
|
403
|
+
_ANT_MARK__: string;
|
|
404
|
+
}, SlotsType<{
|
|
405
|
+
default?: () => VNodeChild;
|
|
406
|
+
}>, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
407
|
+
|
|
408
|
+
declare const localeValues$18: Locale;
|
|
409
|
+
|
|
410
|
+
declare const localeValues$17: Locale;
|
|
411
|
+
|
|
412
|
+
declare const localeValues$16: Locale;
|
|
413
|
+
|
|
414
|
+
declare const localeValues$15: Locale;
|
|
415
|
+
|
|
416
|
+
declare const localeValues$14: Locale;
|
|
417
|
+
|
|
418
|
+
declare const localeValues$13: Locale;
|
|
419
|
+
|
|
420
|
+
declare const localeValues$12: Locale;
|
|
421
|
+
|
|
422
|
+
declare const localeValues$11: Locale;
|
|
423
|
+
|
|
424
|
+
declare const localeValues$10: Locale;
|
|
425
|
+
|
|
426
|
+
declare const localeValues$$: Locale;
|
|
427
|
+
|
|
428
|
+
declare const localeValues$_: Locale;
|
|
429
|
+
|
|
430
|
+
declare const localeValues$Z: Locale;
|
|
431
|
+
|
|
432
|
+
declare const localeValues$Y: Locale;
|
|
433
|
+
|
|
434
|
+
declare const localeValues$X: Locale;
|
|
435
|
+
|
|
436
|
+
declare const localeValues$W: Locale;
|
|
437
|
+
|
|
438
|
+
declare const localeValues$V: Locale;
|
|
439
|
+
|
|
440
|
+
declare const localeValues$U: Locale;
|
|
441
|
+
|
|
442
|
+
declare const localeValues$T: Locale;
|
|
443
|
+
|
|
444
|
+
declare const localeValues$S: Locale;
|
|
445
|
+
|
|
446
|
+
declare const localeValues$R: Locale;
|
|
447
|
+
|
|
448
|
+
declare const localeValues$Q: Locale;
|
|
449
|
+
|
|
450
|
+
declare const localeValues$P: Locale;
|
|
451
|
+
|
|
452
|
+
declare const localeValues$O: Locale;
|
|
453
|
+
|
|
454
|
+
declare const localeValues$N: Locale;
|
|
455
|
+
|
|
456
|
+
declare const localeValues$M: Locale;
|
|
457
|
+
|
|
458
|
+
declare const localeValues$L: Locale;
|
|
459
|
+
|
|
460
|
+
declare const localeValues$K: Locale;
|
|
461
|
+
|
|
462
|
+
declare const localeValues$J: Locale;
|
|
463
|
+
|
|
464
|
+
declare const localeValues$I: Locale;
|
|
465
|
+
|
|
466
|
+
declare const localeValues$H: Locale;
|
|
467
|
+
|
|
468
|
+
declare const localeValues$G: Locale;
|
|
469
|
+
|
|
470
|
+
declare const localeValues$F: Locale;
|
|
471
|
+
|
|
472
|
+
declare const localeValues$E: Locale;
|
|
473
|
+
|
|
474
|
+
declare const localeValues$D: Locale;
|
|
475
|
+
|
|
476
|
+
declare const localeValues$C: Locale;
|
|
477
|
+
|
|
478
|
+
declare const localeValues$B: Locale;
|
|
479
|
+
|
|
480
|
+
declare const localeValues$A: Locale;
|
|
481
|
+
|
|
482
|
+
declare const localeValues$z: Locale;
|
|
483
|
+
|
|
484
|
+
declare const localeValues$y: Locale;
|
|
485
|
+
|
|
486
|
+
declare const localeValues$x: Locale;
|
|
487
|
+
|
|
488
|
+
declare const localeValues$w: Locale;
|
|
489
|
+
|
|
490
|
+
declare const localeValues$v: Locale;
|
|
491
|
+
|
|
492
|
+
declare const localeValues$u: Locale;
|
|
493
|
+
|
|
494
|
+
declare const localeValues$t: Locale;
|
|
495
|
+
|
|
496
|
+
declare const localeValues$s: Locale;
|
|
497
|
+
|
|
498
|
+
declare const localeValues$r: Locale;
|
|
499
|
+
|
|
500
|
+
declare const localeValues$q: Locale;
|
|
501
|
+
|
|
502
|
+
declare const localeValues$p: Locale;
|
|
503
|
+
|
|
504
|
+
declare const localeValues$o: Locale;
|
|
505
|
+
|
|
506
|
+
declare const localeValues$n: Locale;
|
|
507
|
+
|
|
508
|
+
declare const localeValues$m: Locale;
|
|
509
|
+
|
|
510
|
+
declare const localeValues$l: Locale;
|
|
511
|
+
|
|
512
|
+
declare const localeValues$k: Locale;
|
|
513
|
+
|
|
514
|
+
declare const localeValues$j: Locale;
|
|
515
|
+
|
|
516
|
+
declare const localeValues$i: Locale;
|
|
517
|
+
|
|
518
|
+
declare const localeValues$h: Locale;
|
|
519
|
+
|
|
520
|
+
declare const localeValues$g: Locale;
|
|
521
|
+
|
|
522
|
+
declare const localeValues$f: Locale;
|
|
523
|
+
|
|
524
|
+
declare const localeValues$e: Locale;
|
|
525
|
+
|
|
526
|
+
declare const localeValues$d: Locale;
|
|
527
|
+
|
|
528
|
+
declare const localeValues$c: Locale;
|
|
529
|
+
|
|
530
|
+
declare const localeValues$b: Locale;
|
|
531
|
+
|
|
532
|
+
declare const localeValues$a: Locale;
|
|
533
|
+
|
|
534
|
+
declare const localeValues$9: Locale;
|
|
535
|
+
|
|
536
|
+
declare const localeValues$8: Locale;
|
|
537
|
+
|
|
538
|
+
declare const localeValues$7: Locale;
|
|
539
|
+
|
|
540
|
+
declare const localeValues$6: Locale;
|
|
541
|
+
|
|
542
|
+
declare const localeValues$5: Locale;
|
|
543
|
+
|
|
544
|
+
declare const localeValues$4: Locale;
|
|
545
|
+
|
|
546
|
+
declare const localeValues$3: Locale;
|
|
547
|
+
|
|
548
|
+
declare const localeValues$2: Locale;
|
|
549
|
+
|
|
550
|
+
declare const localeValues$1: Locale;
|
|
551
|
+
|
|
552
|
+
declare const localeValues: Locale;
|
|
553
|
+
|
|
554
|
+
/** 兜底数据(上游的 `defaultLocaleData`)。 */
|
|
555
|
+
declare const defaultLocaleData: Locale;
|
|
556
|
+
/**
|
|
557
|
+
* Current component locale and language code. Read both computed refs inside
|
|
558
|
+
* render/computed (or unwrap them in templates) to follow provider updates.
|
|
559
|
+
* Component fragments merge shallowly; context values override defaults.
|
|
560
|
+
*/
|
|
561
|
+
declare function useLocale<C extends LocaleComponentName>(componentName: C, defaultLocale?: Locale[C] | (() => Locale[C])): readonly [ComputedRef<NonNullable<Locale[C]>>, ComputedRef<string | undefined>];
|
|
562
|
+
|
|
563
|
+
export { ANT_MARK, LocaleProvider, localeValues$18 as ar_EG, localeValues$17 as az_AZ, localeValues$16 as bg_BG, localeValues$15 as bn_BD, localeValues$14 as by_BY, localeValues$13 as ca_ES, changeConfirmLocale, localeValues$12 as cs_CZ, localeValues$11 as da_DK, localeValues$10 as de_DE, localeValues$Z as defaultLocale, defaultLocaleData, localeValues$$ as el_GR, localeValues$_ as en_GB, localeValues$Z as en_US, localeValues$Y as es_ES, localeValues$X as es_US, localeValues$W as et_EE, localeValues$V as eu_ES, localeValues$U as fa_IR, localeValues$T as fi_FI, localeValues$S as fr_BE, localeValues$R as fr_CA, localeValues$Q as fr_FR, localeValues$P as ga_IE, getConfirmLocale, localeValues$O as gl_ES, localeValues$N as he_IL, localeValues$M as hi_IN, localeValues$L as hr_HR, localeValues$K as hu_HU, localeValues$J as hy_AM, localeValues$I as id_ID, localeValues$H as is_IS, localeValues$G as it_IT, localeValues$F as ja_JP, localeValues$E as ka_GE, localeValues$D as kk_KZ, localeValues$C as km_KH, localeValues$B as kmr_IQ, localeValues$A as kn_IN, localeValues$z as ko_KR, localeValues$y as ku_IQ, localeContextKey, localeValues$x as lt_LT, localeValues$w as lv_LV, localeValues$v as mk_MK, localeValues$u as ml_IN, localeValues$t as mn_MN, localeValues$s as mr_IN, localeValues$r as ms_MY, localeValues$q as my_MM, localeValues$p as nb_NO, localeValues$o as ne_NP, localeValues$n as nl_BE, localeValues$m as nl_NL, localeValues$l as pl_PL, localeValues$k as pt_BR, localeValues$j as pt_PT, resetConfirmLocale, resetLocaleWarned, localeValues$i as ro_RO, localeValues$h as ru_RU, localeValues$g as si_LK, localeValues$f as sk_SK, localeValues$e as sl_SI, localeValues$d as sq_AL, localeValues$c as sr_RS, localeValues$b as sv_SE, localeValues$a as ta_IN, localeValues$9 as th_TH, localeValues$8 as tk_TK, localeValues$7 as tr_TR, localeValues$6 as uk_UA, localeValues$5 as ur_PK, useConfirmLocale, useLocale, localeValues$4 as uz_UZ, localeValues$3 as vi_VN, localeValues$2 as zh_CN, localeValues$1 as zh_HK, localeValues as zh_TW };
|
|
564
|
+
export type { CarouselLocale, ColorPickerLocale, EmptyLocale, FormLocale, GlobalLocale, Locale, LocaleComponentName, LocaleContextSource, LocaleContextValue, ModalLocale, PaginationLocale, PickerLangLocale, PickerLocale, PopconfirmLocale, QRCodeLocale, TableLocale, TextLocale, TimePickerLocale, TourLocale, TransferLocale, UploadLocale, ValidateMessages };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export { changeConfirmLocale, getConfirmLocale, resetConfirmLocale, useConfirmLocale } from './confirm-locale.mjs';
|
|
2
|
+
export { localeContextKey } from './context.mjs';
|
|
3
|
+
export { ANT_MARK, LocaleProvider, resetLocaleWarned } from './locale-provider.mjs';
|
|
4
|
+
export { default as defaultLocale, default as en_US } from './locales/en_US.mjs';
|
|
5
|
+
export { defaultLocaleData, useLocale } from './use-locale.mjs';
|
|
6
|
+
export { default as ar_EG } from './locales/ar_EG.mjs';
|
|
7
|
+
export { default as az_AZ } from './locales/az_AZ.mjs';
|
|
8
|
+
export { default as bg_BG } from './locales/bg_BG.mjs';
|
|
9
|
+
export { default as bn_BD } from './locales/bn_BD.mjs';
|
|
10
|
+
export { default as by_BY } from './locales/by_BY.mjs';
|
|
11
|
+
export { default as ca_ES } from './locales/ca_ES.mjs';
|
|
12
|
+
export { default as cs_CZ } from './locales/cs_CZ.mjs';
|
|
13
|
+
export { default as da_DK } from './locales/da_DK.mjs';
|
|
14
|
+
export { default as de_DE } from './locales/de_DE.mjs';
|
|
15
|
+
export { default as el_GR } from './locales/el_GR.mjs';
|
|
16
|
+
export { default as en_GB } from './locales/en_GB.mjs';
|
|
17
|
+
export { default as es_ES } from './locales/es_ES.mjs';
|
|
18
|
+
export { default as es_US } from './locales/es_US.mjs';
|
|
19
|
+
export { default as et_EE } from './locales/et_EE.mjs';
|
|
20
|
+
export { default as eu_ES } from './locales/eu_ES.mjs';
|
|
21
|
+
export { default as fa_IR } from './locales/fa_IR.mjs';
|
|
22
|
+
export { default as fi_FI } from './locales/fi_FI.mjs';
|
|
23
|
+
export { default as fr_BE } from './locales/fr_BE.mjs';
|
|
24
|
+
export { default as fr_CA } from './locales/fr_CA.mjs';
|
|
25
|
+
export { default as fr_FR } from './locales/fr_FR.mjs';
|
|
26
|
+
export { default as ga_IE } from './locales/ga_IE.mjs';
|
|
27
|
+
export { default as gl_ES } from './locales/gl_ES.mjs';
|
|
28
|
+
export { default as he_IL } from './locales/he_IL.mjs';
|
|
29
|
+
export { default as hi_IN } from './locales/hi_IN.mjs';
|
|
30
|
+
export { default as hr_HR } from './locales/hr_HR.mjs';
|
|
31
|
+
export { default as hu_HU } from './locales/hu_HU.mjs';
|
|
32
|
+
export { default as hy_AM } from './locales/hy_AM.mjs';
|
|
33
|
+
export { default as id_ID } from './locales/id_ID.mjs';
|
|
34
|
+
export { default as is_IS } from './locales/is_IS.mjs';
|
|
35
|
+
export { default as it_IT } from './locales/it_IT.mjs';
|
|
36
|
+
export { default as ja_JP } from './locales/ja_JP.mjs';
|
|
37
|
+
export { default as ka_GE } from './locales/ka_GE.mjs';
|
|
38
|
+
export { default as kk_KZ } from './locales/kk_KZ.mjs';
|
|
39
|
+
export { default as km_KH } from './locales/km_KH.mjs';
|
|
40
|
+
export { default as kmr_IQ } from './locales/kmr_IQ.mjs';
|
|
41
|
+
export { default as kn_IN } from './locales/kn_IN.mjs';
|
|
42
|
+
export { default as ko_KR } from './locales/ko_KR.mjs';
|
|
43
|
+
export { default as ku_IQ } from './locales/ku_IQ.mjs';
|
|
44
|
+
export { default as lt_LT } from './locales/lt_LT.mjs';
|
|
45
|
+
export { default as lv_LV } from './locales/lv_LV.mjs';
|
|
46
|
+
export { default as mk_MK } from './locales/mk_MK.mjs';
|
|
47
|
+
export { default as ml_IN } from './locales/ml_IN.mjs';
|
|
48
|
+
export { default as mn_MN } from './locales/mn_MN.mjs';
|
|
49
|
+
export { default as mr_IN } from './locales/mr_IN.mjs';
|
|
50
|
+
export { default as ms_MY } from './locales/ms_MY.mjs';
|
|
51
|
+
export { default as my_MM } from './locales/my_MM.mjs';
|
|
52
|
+
export { default as nb_NO } from './locales/nb_NO.mjs';
|
|
53
|
+
export { default as ne_NP } from './locales/ne_NP.mjs';
|
|
54
|
+
export { default as nl_BE } from './locales/nl_BE.mjs';
|
|
55
|
+
export { default as nl_NL } from './locales/nl_NL.mjs';
|
|
56
|
+
export { default as pl_PL } from './locales/pl_PL.mjs';
|
|
57
|
+
export { default as pt_BR } from './locales/pt_BR.mjs';
|
|
58
|
+
export { default as pt_PT } from './locales/pt_PT.mjs';
|
|
59
|
+
export { default as ro_RO } from './locales/ro_RO.mjs';
|
|
60
|
+
export { default as ru_RU } from './locales/ru_RU.mjs';
|
|
61
|
+
export { default as si_LK } from './locales/si_LK.mjs';
|
|
62
|
+
export { default as sk_SK } from './locales/sk_SK.mjs';
|
|
63
|
+
export { default as sl_SI } from './locales/sl_SI.mjs';
|
|
64
|
+
export { default as sq_AL } from './locales/sq_AL.mjs';
|
|
65
|
+
export { default as sr_RS } from './locales/sr_RS.mjs';
|
|
66
|
+
export { default as sv_SE } from './locales/sv_SE.mjs';
|
|
67
|
+
export { default as ta_IN } from './locales/ta_IN.mjs';
|
|
68
|
+
export { default as th_TH } from './locales/th_TH.mjs';
|
|
69
|
+
export { default as tk_TK } from './locales/tk_TK.mjs';
|
|
70
|
+
export { default as tr_TR } from './locales/tr_TR.mjs';
|
|
71
|
+
export { default as uk_UA } from './locales/uk_UA.mjs';
|
|
72
|
+
export { default as ur_PK } from './locales/ur_PK.mjs';
|
|
73
|
+
export { default as uz_UZ } from './locales/uz_UZ.mjs';
|
|
74
|
+
export { default as vi_VN } from './locales/vi_VN.mjs';
|
|
75
|
+
export { default as zh_CN } from './locales/zh_CN.mjs';
|
|
76
|
+
export { default as zh_HK } from './locales/zh_HK.mjs';
|
|
77
|
+
export { default as zh_TW } from './locales/zh_TW.mjs';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineComponent, computed, provide } from 'vue';
|
|
2
|
+
import { useConfirmLocale } from './confirm-locale.mjs';
|
|
3
|
+
import { localeContextKey } from './context.mjs';
|
|
4
|
+
|
|
5
|
+
const ANT_MARK = "internalMark";
|
|
6
|
+
const warned = /* @__PURE__ */ new Set();
|
|
7
|
+
function devWarning(message) {
|
|
8
|
+
if (process.env.NODE_ENV === "production" || typeof console === "undefined") return;
|
|
9
|
+
if (warned.has(message)) return;
|
|
10
|
+
warned.add(message);
|
|
11
|
+
console.error(`Warning: [apollo: LocaleProvider] ${message}`);
|
|
12
|
+
}
|
|
13
|
+
function resetLocaleWarned() {
|
|
14
|
+
warned.clear();
|
|
15
|
+
}
|
|
16
|
+
const LocaleProvider = defineComponent({
|
|
17
|
+
name: "ALocaleProvider",
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
props: {
|
|
20
|
+
locale: { type: Object, default: () => ({}) },
|
|
21
|
+
/** 上游用它判断「是不是官方导出的那个组件」 */
|
|
22
|
+
_ANT_MARK__: { type: String, default: void 0 }
|
|
23
|
+
},
|
|
24
|
+
slots: Object,
|
|
25
|
+
setup(props, { slots }) {
|
|
26
|
+
if (props._ANT_MARK__ !== ANT_MARK) {
|
|
27
|
+
devWarning(
|
|
28
|
+
"`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead: http://u.ant.design/locale"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const value = computed(() => ({ ...props.locale, exist: true }));
|
|
32
|
+
provide(localeContextKey, value);
|
|
33
|
+
useConfirmLocale(() => props.locale?.Modal);
|
|
34
|
+
return () => slots.default?.();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { ANT_MARK, LocaleProvider, resetLocaleWarned };
|