initial commit - code moved to separate repo
This commit is contained in:
81
components/x-date-pickers/locales/bgBG.ts
Normal file
81
components/x-date-pickers/locales/bgBG.ts
Normal file
@ -0,0 +1,81 @@
|
||||
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
|
||||
import { getPickersLocalization } from './utils/getPickersLocalization';
|
||||
|
||||
// Този обект не е Partial<PickersLocaleText>, защото това са стойностите по подразбиране
|
||||
|
||||
const bgBGPickers: PickersLocaleText<any> = {
|
||||
// Навигация в календара
|
||||
previousMonth: 'Предишен месец',
|
||||
nextMonth: 'Следващ месец',
|
||||
|
||||
// Навигация на изгледа
|
||||
openPreviousView: 'отвори предишен изглед',
|
||||
openNextView: 'отвори следващ изглед',
|
||||
calendarViewSwitchingButtonAriaLabel: (view) =>
|
||||
view === 'year'
|
||||
? 'отворен е годишен изглед, превключи към календарен изглед'
|
||||
: 'отворен е календарен изглед, превключи към годишен изглед',
|
||||
|
||||
// Мяста за дата
|
||||
start: 'Начало',
|
||||
end: 'Край',
|
||||
|
||||
// Акционен бар
|
||||
cancelButtonLabel: 'Отказ',
|
||||
clearButtonLabel: 'Изчисти',
|
||||
okButtonLabel: 'ОК',
|
||||
todayButtonLabel: 'Днес',
|
||||
|
||||
// Заглавия на инструментална лента
|
||||
datePickerToolbarTitle: 'Изберете дата',
|
||||
dateTimePickerToolbarTitle: 'Изберете дата и час',
|
||||
timePickerToolbarTitle: 'Изберете час',
|
||||
dateRangePickerToolbarTitle: 'Изберете период на дата',
|
||||
|
||||
// Етикети на часовника
|
||||
clockLabelText: (view, time, adapter) =>
|
||||
`Изберете ${view}. ${time === null ? 'Не е избрано време' : `Избраният час е ${adapter.format(time, 'fullTime')}`
|
||||
}`,
|
||||
hoursClockNumberText: (hours) => `${hours} часа`,
|
||||
minutesClockNumberText: (minutes) => `${minutes} минути`,
|
||||
secondsClockNumberText: (seconds) => `${seconds} секунди`,
|
||||
|
||||
// Етикети на цифров часовник
|
||||
selectViewText: (view) => `Изберете ${view}`,
|
||||
|
||||
// Етикети на календара
|
||||
calendarWeekNumberHeaderLabel: 'Номер на седмица',
|
||||
calendarWeekNumberHeaderText: '#',
|
||||
calendarWeekNumberAriaLabelText: (weekNumber) => `Седмица ${weekNumber}`,
|
||||
calendarWeekNumberText: (weekNumber) => `${weekNumber}`,
|
||||
|
||||
// Етикети за отваряне на избора
|
||||
openDatePickerDialogue: (value, utils) =>
|
||||
value !== null && utils.isValid(value)
|
||||
? `Изберете дата, избраната дата е ${utils.format(value, 'fullDate')}`
|
||||
: 'Изберете дата',
|
||||
openTimePickerDialogue: (value, utils) =>
|
||||
value !== null && utils.isValid(value)
|
||||
? `Изберете час, избраният час е ${utils.format(value, 'fullTime')}`
|
||||
: 'Изберете час',
|
||||
|
||||
fieldClearLabel: 'Изчисти стойност',
|
||||
|
||||
// Етикети на таблицата
|
||||
timeTableLabel: 'изберете време',
|
||||
dateTableLabel: 'изберете дата',
|
||||
|
||||
// Заместващи текстове в секции на полета
|
||||
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',
|
||||
};
|
||||
|
||||
export const DEFAULT_LOCALE = bgBGPickers;
|
||||
|
||||
export const bgBG = getPickersLocalization(bgBGPickers);
|
@ -0,0 +1,13 @@
|
||||
import { PickersLocaleText } from './pickersLocaleTextApi';
|
||||
|
||||
export const getPickersLocalization = (pickersTranslations: Partial<PickersLocaleText<any>>) => {
|
||||
return {
|
||||
components: {
|
||||
MuiLocalizationProvider: {
|
||||
defaultProps: {
|
||||
localeText: { ...pickersTranslations },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
115
components/x-date-pickers/locales/utils/pickersLocaleTextApi.ts
Normal file
115
components/x-date-pickers/locales/utils/pickersLocaleTextApi.ts
Normal file
@ -0,0 +1,115 @@
|
||||
import { TimeViewWithMeridiem } from '../../internals/models';
|
||||
import { DateView, TimeView, MuiPickersAdapter, FieldSectionContentType } from '../../models';
|
||||
|
||||
export interface PickersComponentSpecificLocaleText {
|
||||
/**
|
||||
* Title displayed in the toolbar of the `DatePicker` 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 `TimePicker` 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 `DateTimePicker` 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 `DateRangePicker` and its variants.
|
||||
* Will be overridden by the `toolbarTitle` translation key passed directly on the picker.
|
||||
*/
|
||||
dateRangePickerToolbarTitle: string;
|
||||
}
|
||||
|
||||
export interface PickersComponentAgnosticLocaleText<TDate> {
|
||||
// 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 placeholders
|
||||
start: string;
|
||||
end: string;
|
||||
|
||||
// Action bar
|
||||
cancelButtonLabel: string;
|
||||
clearButtonLabel: string;
|
||||
okButtonLabel: string;
|
||||
todayButtonLabel: string;
|
||||
|
||||
// Clock labels
|
||||
clockLabelText: (view: TimeView, time: TDate | null, adapter: MuiPickersAdapter<TDate>) => string;
|
||||
hoursClockNumberText: (hours: string) => string;
|
||||
minutesClockNumberText: (minutes: string) => string;
|
||||
secondsClockNumberText: (seconds: string) => string;
|
||||
|
||||
// Digital clock labels
|
||||
selectViewText: (view: TimeViewWithMeridiem) => string;
|
||||
|
||||
// Open picker labels
|
||||
openDatePickerDialogue: (date: TDate | null, utils: MuiPickersAdapter<TDate>) => string;
|
||||
openTimePickerDialogue: (date: TDate | null, utils: MuiPickersAdapter<TDate>) => 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;
|
||||
}
|
||||
|
||||
export interface PickersLocaleText<TDate>
|
||||
extends PickersComponentAgnosticLocaleText<TDate>,
|
||||
PickersComponentSpecificLocaleText { }
|
||||
|
||||
export type PickersInputLocaleText<TDate> = Partial<PickersLocaleText<TDate>>;
|
||||
|
||||
/**
|
||||
* 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<TDate>
|
||||
extends Partial<PickersComponentAgnosticLocaleText<TDate>> {
|
||||
/**
|
||||
* 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<any>;
|
||||
|
||||
export type LocalizedComponent<
|
||||
TDate,
|
||||
Props extends { localeText?: PickersInputComponentLocaleText<TDate> },
|
||||
> = Omit<Props, 'localeText'> & { localeText?: PickersInputLocaleText<TDate> };
|
Reference in New Issue
Block a user