Our state of the art Gantt chart
I do assign the language using the following function
export const setLocaleBasedOnUser = (languageName: string) => {
try {
const locale = Object.values(LocaleManager.locales).find(locale => locale.localeName.toLowerCase() === languageName.toLowerCase());
const localeCode = locale?.localeName;
if (languageName.toLowerCase() === 'de') {
const newLocaleDe= { ...locale };
if (newLocaleDe) {
const dateHelper = newLocaleDe.DateHelper;
dateHelper['unitNames'][8] = {
single: "Tag",
plural: "Tag(e)",
abbrev: "T"
};
newLocaleDe.DateHelper = dateHelper;
}
LocaleHelper.publishLocale('de', newLocaleDe);
}
LocaleManager.applyLocale(localeCode);
/*
add objects and new properties here
localeObject.<Object>.<Attribute> = getMessage(Enums.MessageEnum.Bryntum<Object>_<Attribute>);
example
locale.Gantt.Edit = getMessage(Enums.MessageEnum.BryntumGantt_Edit);
*/
}
catch (error) {
console.error('Failed to assign messageEnums and apply locale:', error);
}
};
this works, but it does update the Yearly quarters from Q1 to EQ1 which is unwanted
I think that in german anyway tag(e)/t should be as any other german word capitalised.
Hi,
I don't see that in online demo here https://bryntum.com/products/gantt/examples/localization/
Please try yourself
For testing I added this code to the end of file
const locale = Object.values(LocaleManager.locales).find(locale => locale.localeName.toLowerCase() === 'de');
const localeCode = locale?.localeName;
const newLocaleDe= { ...locale };
if (newLocaleDe) {
const dateHelper = newLocaleDe.DateHelper;
dateHelper['unitNames'][8] = {
single: "Tag",
plural: "Tag(e)",
abbrev: "T"
};
newLocaleDe.DateHelper = dateHelper;
}
LocaleHelper.publishLocale('de', newLocaleDe);
All the best,
Alex Lazarev
How to ask for help? Please read our Support Policy
We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services
When I do assign the new values for unitNames[8] is when the quarter change to eQuarters.
see this in the attached files.
In the other file see the added canonicalUnitName. ( Iassume this is used somewhere to assign the abbreviation)
The complaint from the customer anyway is that the formal German should be capitalised when it is a name. So from my point of view Bryntum should change this as German standard.
This overwriting of the equarter seems to be fine, however I do not know what is the definition of eQuarter.
if (languageName.toLowerCase() === 'de') {
const newLocaleDe= { ...locale };
if (newLocaleDe) {
const dateHelper = cloneDeep(newLocaleDe.DateHelper);
console.log(dateHelper);
dateHelper['unitNames'][8] = {
single: "Tag",
plural: "Tag(e)",
abbrev: "T"
};
dateHelper['unitNames'][15].abbrev = "q";
//delete dateHelper['unitNames'][15];
newLocaleDe.DateHelper = dateHelper;
console.log(dateHelper);
}
LocaleHelper.publishLocale('De', newLocaleDe);
}
LocaleManager.applyLocale(localeCode);
Attachments
55586.png (106.28 KiB) Viewed 583 times
55586-2.png (69.84 KiB) Viewed 583 times
Hi,
I've opened a ticket for a bug with localization https://github.com/bryntum/support/issues/11888
You can subscribe on ticket updates to be notified when it's done.
Thank you for the report!
Regarding to "e" in names after locale change, I can't reproduce this. Do you see that in our demo using the link and the code I shared before? Any chance to get runnable code/steps to reproduce it and confirm a bug or find a reason?
All the best,
Alex Lazarev
How to ask for help? Please read our Support Policy
We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services