@mui/x-date-pickers
Version:
The community edition of the Date and Time Picker components (MUI X).
71 lines (69 loc) • 3.06 kB
JavaScript
import { getPickersLocalization } from "./utils/getPickersLocalization.js";
// This object is not Partial<PickersLocaleText> because it is the default values
const enUSPickers = {
// Calendar navigation
previousMonth: 'Previous month',
nextMonth: 'Next month',
// View navigation
openPreviousView: 'Open previous view',
openNextView: 'Open next view',
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'year view is open, switch to calendar view' : 'calendar view is open, switch to year view',
// DateRange labels
start: 'Start',
end: 'End',
startDate: 'Start date',
startTime: 'Start time',
endDate: 'End date',
endTime: 'End time',
// Action bar
cancelButtonLabel: 'Cancel',
clearButtonLabel: 'Clear',
okButtonLabel: 'OK',
todayButtonLabel: 'Today',
// Toolbar titles
datePickerToolbarTitle: 'Select date',
dateTimePickerToolbarTitle: 'Select date & time',
timePickerToolbarTitle: 'Select time',
dateRangePickerToolbarTitle: 'Select date range',
// Clock labels
clockLabelText: (view, time, utils, formattedTime) => `Select ${view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'No time selected' : `Selected time is ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
hoursClockNumberText: hours => `${hours} hours`,
minutesClockNumberText: minutes => `${minutes} minutes`,
secondsClockNumberText: seconds => `${seconds} seconds`,
// Digital clock labels
selectViewText: view => `Select ${view}`,
// Calendar labels
calendarWeekNumberHeaderLabel: 'Week number',
calendarWeekNumberHeaderText: '#',
calendarWeekNumberAriaLabelText: weekNumber => `Week ${weekNumber}`,
calendarWeekNumberText: weekNumber => `${weekNumber}`,
// Open picker labels
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Choose date, selected date is ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Choose date',
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Choose time, selected time is ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Choose time',
fieldClearLabel: 'Clear',
// Table labels
timeTableLabel: 'pick time',
dateTableLabel: 'pick date',
// Field section placeholders
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
fieldDayPlaceholder: () => 'DD',
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
fieldHoursPlaceholder: () => 'hh',
fieldMinutesPlaceholder: () => 'mm',
fieldSecondsPlaceholder: () => 'ss',
fieldMeridiemPlaceholder: () => 'aa',
// View names
year: 'Year',
month: 'Month',
day: 'Day',
weekDay: 'Week day',
hours: 'Hours',
minutes: 'Minutes',
seconds: 'Seconds',
meridiem: 'Meridiem',
// Common
empty: 'Empty'
};
export const DEFAULT_LOCALE = enUSPickers;
export const enUS = getPickersLocalization(enUSPickers);