Set locale in an Angular app dynamically

Good morning :slight_smile:
When i import locale file at the top of the Scheduler component - everything works fine

But i need to set locale depending on the parameter. I’ve checked this snippet (DHTMLX Snippets) and tried to do the same. CDN js file successfully loaded but it doesn’t work even after scheduler init


I have no errors in the console but the locale just doesn’t apply.

Here is my func (copied from snippet):

Also i tried dynamic Typescript imports but the effect was the same - js locale file was loaded but didn’t work.

Is there some workarounds for Angular or i did smth wrong?)
Thanks

Finally, i did it manually:)
Like this: this.scheduler.locale = <locale from source files>.locale;
But still don’t know why Scheduler.plugin() doesn’t work if js script isn’t included in bundle.

Hi @Kendzi

Can you please clarify what exactly do you do with Scheduler.plugin and how it doesn’t work for you?

Ideally, if you could share a simple angular app which I could run locally and check the issue.
Scheduler.plugin takes a single parameter - a function that takes a scheduler instance as an argument.

Scheduler.plugin(function(scheduler){ 
scheduler.$myPlugin = true;// every scheduler instance on the page will have `$myPlugin` property defined 
});

This function will be called for every instance of the scheduler that exists on the page (the default window.scheduler and any instances you create using Scheduler.getSchedulerInstance). This is used to extend the scheduler with the new functionality or to apply some default configuration to every scheduler object.

Please provide some extra info on how you use this method and what exactly doesn’t work.