Premium support for our pure JavaScript UI components


Post by TeemuL »

Hello,

I have an app where the user can have separate language selection and cultural settings.

Language selection changes the text translations of the whole product. Cultural setting should change only things such as date/time formatting, week start day, time type (12hour/24hour clock).

The user could have set finnish language and english culture, or finnish language and culture, etc...

Now, locale registration in Bryntum components is done with the LocaleManager and the locale-object keeps both of these (language translations and cultural formatting) in its properties. Is there an easy way to make these two separate?

I was thinking of making a separate locale-objects: "languageLocale" and "cultureLocale", then merge these two using LocaleManager's extendLocale-method based on the user settings. This could work, but that means I would have to write locales by myself for each language and culture selection, which seems like alot of work and maintenance.

If there is no existing solution for this, could it be added in the future? Best/easiest solution for me would be if I could just import a "localeLanguageSettingsEnglish" and "localeCulturalSettingsEnglish" (for swedish too as you already have it) and register those with properties for example: LocaleManager.languageLocale = localeLanguageSettingsEnglish. Just an idea :)


Post by alex.l »

Hi TeemuL,

Nothing build-in we could suggest you. No plans to add something like that, it is user-specific what exactly should be included into it and easily doable using merge/applyLocales methods without need to define locales many times. If you use our pre-defined locales, split them to language/culture specific parts as you described to have it in a single place, and merge afterwards.
But that is a really good idea to improve our localization demo, here is a feature request: https://github.com/bryntum/support/issues/3592
The approach you described will work. Be aware to use correct DateHelper.locale property according to BCP 47 standards.
Full info here: https://bryntum.com/docs/scheduler/guide/Scheduler/customization/localization#change-date-formats

All the best,
Alex


Post Reply