From 0c6bef0e175f929148b7f86c07c0f47039831f01 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 31 Jan 2025 09:54:58 +0100 Subject: [PATCH] add comment --- .../entity-action/common/delete/delete.action.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts index a06468f874..4344e940c8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts @@ -26,9 +26,16 @@ export class UmbDeleteEntityAction extends UmbEntityActionBase { + const message = this.args.meta.confirm?.message ?? '#defaultdialogs_confirmdelete'; + + /* We need to replace the token in a translation with the item name. + A string can potentially consist of multiple translation keys. + First we find all the translation keys in message. */ + const keysFromMessageString = this.#localize.getKeysFromString(message); + + // Second we create a map of the translation keys found in the message and the arguments that should replace the tokens. + // This will enable the localize service to pass and replace the tokens in the all the translations with the item name. + const argsMap: UmbLocalizeStringArgsMap = keysFromMessageString.reduce((acc: UmbLocalizeStringArgsMap, key) => { acc[key] = [item.name]; return acc; }, {}); @@ -36,7 +43,7 @@ export class UmbDeleteEntityAction extends UmbEntityActionBase