components icon indicating copy to clipboard operation
components copied to clipboard

MatDatepickerIntl switch between English and French languages

Open ceruleanSun opened this issue 6 years ago • 2 comments

Hi all,

I am trying to implement MatDatepickerIntl for English and French languages. I need aria-label to be changed whenever I switch the language in the application.

What troubleshooting steps have you tried?

Have tried implementing with just one language (either En or Fr), works fine. Cannot understand how I can implement that for 2 languages.

My steps are: 1.I have declared the provider under my app module ts: {provide: MatDatepickerIntl, useClass: DatepickerEn }

  1. and then in DatepickerEn class I am simply setting:
export class DatepickerEn  extends MatDatepickerIntl  {
  constructor() {
    super();
   
}
openCalendarLabel = 'Open Datepicker'
 }

But again, it just works fine for 1 language. How can I include 2 language?

Environment

  • Angular: 7
  • CDK/Material: 7
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

ceruleanSun avatar Jan 27 '20 18:01 ceruleanSun

We don't currently support switching language like this at run-time. This is something we may consider for the the future.

jelbourn avatar May 28 '20 22:05 jelbourn

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.