Fixed newly created "Default" swimlane are displayed as "key 'default (LOCALE)' returned an object instead of string".

Thanks to brlin-tw and xet7 !

Fixes #6064
This commit is contained in:
Lauri Ojansivu 2026-01-20 20:44:57 +02:00
parent 320b76aec4
commit ce55f0d8f4
4 changed files with 33 additions and 5 deletions

View file

@ -881,7 +881,7 @@ template(name="copyAndMoveCard")
label {{_ 'swimlanes'}}:
select.js-select-swimlanes
each swimlanes
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
label {{_ 'lists'}}:
select.js-select-lists

View file

@ -185,7 +185,7 @@ template(name="copyChecklistPopup")
label {{_ 'swimlanes'}}:
select.js-select-swimlanes
each swimlanes
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
label {{_ 'lists'}}:
select.js-select-lists
@ -210,7 +210,7 @@ template(name="moveChecklistPopup")
label {{_ 'swimlanes'}}:
select.js-select-swimlanes
each swimlanes
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
label {{_ 'lists'}}:
select.js-select-lists

View file

@ -239,7 +239,7 @@ template(name="moveSelectionPopup")
label {{_ 'swimlanes'}}:
select.js-select-swimlanes
each swimlanes
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
label {{_ 'lists'}}:
select.js-select-lists
@ -271,7 +271,7 @@ template(name="copySelectionPopup")
label {{_ 'swimlanes'}}:
select.js-select-swimlanes
each swimlanes
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
label {{_ 'lists'}}:
select.js-select-lists

View file

@ -1,4 +1,5 @@
import { ReactiveCache } from '/imports/reactiveCache';
import { TAPi18n } from '/imports/i18n';
export class DialogWithBoardSwimlaneList extends BlazeComponent {
/** returns the card dialog options
@ -134,6 +135,33 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
return ret;
}
/** Fix swimlane title translation issue for "Default" swimlane
* @param title the swimlane title
* @return the properly translated title
*/
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;
}
}
/** get the board data from the server
* @param boardId get the board data of this board id
*/