Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/datepicker): add i18n strings #25024

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions src/material/datepicker/datepicker-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,51 @@ export class MatDatepickerIntl {
readonly changes: Subject<void> = new Subject<void>();

/** A label for the calendar popup (used by screen readers). */
calendarLabel: string = 'Calendar';
calendarLabel = 'Calendar';

/** A label for the button used to open the calendar popup (used by screen readers). */
openCalendarLabel: string = 'Open calendar';
openCalendarLabel = 'Open calendar';

/** Label for the button used to close the calendar popup. */
closeCalendarLabel: string = 'Close calendar';
closeCalendarLabel = 'Close calendar';

/** A label for the previous month button (used by screen readers). */
prevMonthLabel: string = 'Previous month';
prevMonthLabel = 'Previous month';

/** A label for the next month button (used by screen readers). */
nextMonthLabel: string = 'Next month';
nextMonthLabel = 'Next month';

/** A label for the previous year button (used by screen readers). */
prevYearLabel: string = 'Previous year';
prevYearLabel = 'Previous year';

/** A label for the next year button (used by screen readers). */
nextYearLabel: string = 'Next year';
nextYearLabel = 'Next year';

/** A label for the previous multi-year button (used by screen readers). */
prevMultiYearLabel: string = 'Previous 24 years';
prevMultiYearLabel = 'Previous 24 years';

/** A label for the next multi-year button (used by screen readers). */
nextMultiYearLabel: string = 'Next 24 years';
nextMultiYearLabel = 'Next 24 years';

/** A label for the 'switch to month view' button (used by screen readers). */
switchToMonthViewLabel: string = 'Choose date';
switchToMonthViewLabel = 'Choose date';

/** A label for the 'switch to year view' button (used by screen readers). */
switchToMultiYearViewLabel: string = 'Choose month and year';
switchToMultiYearViewLabel = 'Choose month and year';

/** Formats a range of years. */
/** A label for the first date of a range of dates (used by screen readers). */
startDateLabel = 'Start date';

/** A label for the last date of a range of dates (used by screen readers). */
endDateLabel = 'End date';

/** Formats a range of years (used for visuals). */
formatYearRange(start: string, end: string): string {
return `${start} \u2013 ${end}`;
}

/** Formats a label for a range of years (used by screen readers). */
formatYearRangeLabel(start: string, end: string): string {
return `${start} to ${end}`;
}
}
3 changes: 3 additions & 0 deletions tools/public_api_guard/material/datepicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,17 @@ export class MatDatepickerIntl {
calendarLabel: string;
readonly changes: Subject<void>;
closeCalendarLabel: string;
endDateLabel: string;
formatYearRange(start: string, end: string): string;
formatYearRangeLabel(start: string, end: string): string;
nextMonthLabel: string;
nextMultiYearLabel: string;
nextYearLabel: string;
openCalendarLabel: string;
prevMonthLabel: string;
prevMultiYearLabel: string;
prevYearLabel: string;
startDateLabel: string;
switchToMonthViewLabel: string;
switchToMultiYearViewLabel: string;
// (undocumented)
Expand Down