Our pure JavaScript Scheduler component


Post by Jerther »

Hi Alex! Yes I just meant to share this with you. It's usually a breeze when following your upgrade guides but for this one I had to scratch my head quite a bit.


Post by alex.l »

Don't those 2 have same code except the thing that in upgrade guide we suggested to publish locale before apply and in your version you apply locale and extend with new props in a single command?

All the best,
Alex


Post by Jerther »

What I mean is that if I follow the upgrade guide:

LocaleManager.extendLocale has been deprecated. LocaleManager.applyLocale should be used instead.
Old Code:

LocaleManager.extendLocale('Es', {
    desc : 'Spanish', locale : {
        locale : {
            /* localization */
        }
    }
});

New code:

LocaleManager.applyLocale({
    localeName : 'Es',
    localeDesc : 'Spanish',
    localeCode : 'es',
    /* localization */
});

My code was:

LocaleManager.extendLocale('En', myLocale);

So I tried to adapt what the guide said and came up with this:

LocaleManager.applyLocale({
    localeName : 'En',
    localeDesc : 'English (US)',
    localeCode : 'en-US',
    myLocale
});

But that didn't work. This did not either:

LocaleManager.applyLocale({
    localeName : 'En',
    myLocale
});

This did the trick:

LocaleManager.applyLocale('En', myLocale);

Post by alex.l »

Thanks for clarifying, I see the problem now!
I've opened a ticket to fix this right away https://github.com/bryntum/support/issues/7941
Thanks for your time!

All the best,
Alex


Post by ghulam.ghous »

Hi Jerther,

I have checked the ticket and issue. The new code mentioned in the upgrade guide https://bryntum.com/products/gantt/docs/guide/Gantt/upgrades/5.3.0 works. The issue was with your code. You were using:

LocaleManager.applyLocale({
    localeName : 'En',
    localeDesc : 'English (US)',
    localeCode : 'en-US',
    myLocale
});

The above code resulted in the nameOfConfig parameter in applyLocale method to:

nameOrConfig ={
    localeName : 'En',
    localeDesc : 'English (US)',
    localeCode : 'en-US',
    myLocale : myLocale
}

But our implementation expects the nameOrConfig parameter in applyLocale to be in the following manner:

nameOrConfig ={
    localeName : 'En',
    localeDesc : 'English (US)',
    localeCode : 'en-US',
    locale : myLocale
}

More specifically it expects locale key in the config object that in your case was missing. Changing the your code to below worked:

LocaleManager.applyLocale({
    localeName : 'En',
    localeDesc : 'English (US)',
    localeCode : 'en-US',
    locale: myLocale
});

And similarly this will also works:

LocaleManager.applyLocale({
    localeName : 'En',
    locale : myLocale
});

Regards,
Ghous


Post by Jerther »

Oh, I understand. It's quite obvious now with your explanations. Thank you Ghous :)


Post Reply