Page 1 of 1

lwc localManager error

Posted: Mon Feb 06, 2023 2:28 pm
by f.langlais

HI,
i created a file 'scheduler.locale.Fr.js' in my static resource.
I don't know how to use localManager.
My code :

         Promise.all([
            loadScript(this, SCHEDULER + '/scheduler.lwc.module.js'),
            loadStyle(this, SCHEDULER + '/scheduler.stockholm.css'),
            loadStyle(this, SCHEDULER + '/locales/scheduler.locale.Fr.js')

    ])
        .then(() => {

            this.DH        = bryntum.scheduler.DateHelper;
            this.today     = this.DH.clearTime(new Date());
            this.start     = this.DH.startOf(this.today, 'week');
            this.center    = true; 
            this.animate   = 2000;
            this.highlight = true;
            
            this.localManager();
            this.createScheduler();
            this.createSplitter();
            this.createGrid(this.ListEventNotPlanned);
            this.createDrag();   

and my localManager function :

    localManager()
    {
        bryntum.scheduler.LocaleManager.registerLocale('Fr', {
            desc : 'French', locale : {
                localeName : 'Fr',
                localeDesc : 'French',
                /* other localization */
            }
        });

    //bryntum.scheduler.LocaleManager.applyLocale('Fr');

}

i have an error = 'undefined'
can you help me, it's the good way to use localeManager ?

Br


Re: lwc localManager error

Posted: Mon Feb 06, 2023 3:38 pm
by f.langlais

when i comment 'loadStyle(this, SCHEDULER + '/locales/scheduler.locale.Fr.js')', i don't have error


Re: lwc localManager error

Posted: Mon Feb 06, 2023 4:27 pm
by f.langlais

i load Nederlands file :

            loadStyle(this, SCHEDULER + '/locales/scheduler.locale.Nl.js')

I don't have this error.

my function :

    localManager()
    {
        bryntum.scheduler.LocaleManager.registerLocale('Nl', {
            desc : 'Nederlands', locale : {
                localeName : 'Nl',
                localeDesc : 'Nederlands',
            }
        });

    bryntum.scheduler.LocaleManager.applyLocale('Nl');

}

but the ligne

        bryntum.scheduler.LocaleManager.applyLocale('Nl');

perform this error : 'createScheduler:TypeError: Cannot read properties of undefined (reading 'abbrev')'

and
'scheduler.lwc.module.js:173860 Uncaught (in promise) TypeError: Cannot destructure property 'left' of 'me.viewportCoords' as it is undefined.
at HorizontalRendering.renderer (scheduler.lwc.module.js:173860:13)
at TimeAxisColumn.internalRenderer (scheduler.lwc.module.js:129038:35)
at Row.renderCell (scheduler.lwc.module.js:45410:37)
at Row.render (scheduler.lwc.module.js:45274:21)
at RowManager.renderFromRow (scheduler.lwc.module.js:64072:15)
at RowManager.refresh (scheduler.lwc.module.js:64147:12)
at Scheduler.refreshRows (scheduler.lwc.module.js:73230:22)
at Scheduler.refreshRows (scheduler.lwc.module.js:168025:15)
at Scheduler.refresh (scheduler.lwc.module.js:167981:18)
at eval (scheduler.lwc.module.js:168069:45)

BR


Re: lwc localManager error

Posted: Tue Feb 07, 2023 3:46 pm
by alex.l

Why did you load localization js as loadStyle?

The error might be caused by not full localization file. You might be missing some values in your file, but it should be full. So better to extend from our locale or copy it and apply required changes one by one.
https://bryntum.com/products/scheduler/docs/api/Core/localization/LocaleManager#function-extendLocale
https://bryntum.com/products/scheduler/docs/guide/Scheduler/customization/localization


Re: lwc localManager error

Posted: Tue Feb 07, 2023 4:32 pm
by f.langlais

HI,

i made a mistake, sorry
close this post

BR