-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathpickersLocaleTextApi.ts
136 lines (117 loc) · 4.56 KB
/
pickersLocaleTextApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import { TimeViewWithMeridiem } from '../../internals/models';
import { DateView, TimeView, FieldSectionContentType } from '../../models';
export interface PickersComponentSpecificLocaleText {
/**
* Title displayed in the toolbar of the Date Picker and its variants.
* Will be overridden by the `toolbarTitle` translation key passed directly on the Picker.
*/
datePickerToolbarTitle: string;
/**
* Title displayed in the toolbar of the Time Picker and its variants.
* Will be overridden by the `toolbarTitle` translation key passed directly on the Picker.
*/
timePickerToolbarTitle: string;
/**
* Title displayed in the toolbar of the Date Time Picker and its variants.
* Will be overridden by the `toolbarTitle` translation key passed directly on the Picker.
*/
dateTimePickerToolbarTitle: string;
/**
* Title displayed in the toolbar of the Date Range Picker and its variants.
* Will be overridden by the `toolbarTitle` translation key passed directly on the Picker.
*/
dateRangePickerToolbarTitle: string;
/**
* Title displayed in the toolbar of the `TimeRangePicker` and its variants.
* Will be overridden by the `toolbarTitle` translation key passed directly on the picker.
*/
timeRangePickerToolbarTitle: string;
}
export interface PickersComponentAgnosticLocaleText {
// Calendar navigation
previousMonth: string;
nextMonth: string;
// Calendar week number
calendarWeekNumberHeaderLabel: string;
calendarWeekNumberHeaderText: string;
calendarWeekNumberAriaLabelText: (weekNumber: number) => string;
calendarWeekNumberText: (weekNumber: number) => string;
// View navigation
openPreviousView: string;
openNextView: string;
calendarViewSwitchingButtonAriaLabel: (currentView: DateView) => string;
// DateRange labels
start: string;
end: string;
startDate: string;
startTime: string;
endDate: string;
endTime: string;
// Action bar
cancelButtonLabel: string;
clearButtonLabel: string;
okButtonLabel: string;
todayButtonLabel: string;
// Clock labels
clockLabelText: (view: TimeView, formattedTime: string | null) => string;
hoursClockNumberText: (hours: string) => string;
minutesClockNumberText: (minutes: string) => string;
secondsClockNumberText: (seconds: string) => string;
// Digital clock labels
selectViewText: (view: TimeViewWithMeridiem) => string;
// Open Picker labels
openDatePickerDialogue: (formattedDate: string | null) => string;
openTimePickerDialogue: (formattedTime: string | null) => string;
openRangePickerDialogue: (formattedRange: string | null) => string;
// Clear button label
fieldClearLabel: string;
// Table labels
timeTableLabel: string;
dateTableLabel: string;
// Field section placeholders
fieldYearPlaceholder: (params: { digitAmount: number; format: string }) => string;
fieldMonthPlaceholder: (params: {
contentType: FieldSectionContentType;
format: string;
}) => string;
fieldDayPlaceholder: (params: { format: string }) => string;
fieldWeekDayPlaceholder: (params: {
contentType: FieldSectionContentType;
format: string;
}) => string;
fieldHoursPlaceholder: (params: { format: string }) => string;
fieldMinutesPlaceholder: (params: { format: string }) => string;
fieldSecondsPlaceholder: (params: { format: string }) => string;
fieldMeridiemPlaceholder: (params: { format: string }) => string;
// View names - reflects available `FieldSectionType` options
year: string;
month: string;
day: string;
weekDay: string;
hours: string;
minutes: string;
seconds: string;
meridiem: string;
// Common
empty: string;
}
export interface PickersLocaleText
extends PickersComponentAgnosticLocaleText,
PickersComponentSpecificLocaleText {}
export type PickersInputLocaleText = Partial<PickersLocaleText>;
/**
* Translations that can be provided directly to the Picker components.
* It contains some generic translations like `toolbarTitle`
* which will be dispatched to various translations keys in `PickersLocaleText`, depending on the pickers received them.
*/
export interface PickersInputComponentLocaleText
extends Partial<PickersComponentAgnosticLocaleText> {
/**
* Title displayed in the toolbar of this Picker.
* Will override the global translation keys like `datePickerToolbarTitle` passed to the `LocalizationProvider`.
*/
toolbarTitle?: string;
}
export type PickersTranslationKeys = keyof PickersLocaleText;
export type LocalizedComponent<Props extends { localeText?: PickersInputComponentLocaleText }> =
Omit<Props, 'localeText'> & { localeText?: PickersInputLocaleText };