Fix Swimlane Default title from "key default returned an object instead of string" to translated title of "Default".

Thanks to titho85, hpvb and xet7 !

Fixes #4763,
fixes #4742
This commit is contained in:
Lauri Ojansivu 2023-09-14 21:10:18 +03:00
parent 9a9dbd26f9
commit 73a25775e1
4 changed files with 80 additions and 5 deletions

View file

@ -593,6 +593,31 @@ BlazeComponent.extendComponent({
},
}).register('linkCardPopup');
Template.linkCardPopup.helpers({
isTitleDefault(title) {
// https://github.com/wekan/wekan/issues/4763
// https://github.com/wekan/wekan/issues/4742
// Translation text for "default" does not work, it returns an object.
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
// This can happen, if swimlane does not have name.
// Yes, this is fixing the symptom (Swimlane title does not have title)
// instead of fixing the problem (Add Swimlane title when creating swimlane)
// because there could be thousands of swimlanes, adding name Default to all of them
// would be very slow.
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
return 'Default';
} else {
return `${TAPi18n.__('defaultdefault')}`;
}
} else if (title === 'Default') {
return `${TAPi18n.__('defaultdefault')}`;
} else {
return title;
}
},
});
BlazeComponent.extendComponent({
mixins() {
return [];