diff --git a/src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts b/src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts index e168fc2269..b4ab6c71bc 100644 --- a/src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts +++ b/src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts @@ -478,7 +478,7 @@ export default { anchorLinkPicker: 'Lokalt link / querystreng', anchorInsert: 'Navn på lokalt link', closeThisWindow: 'Luk denne dialog', - confirmdelete: 'Er du sikker på at du vil slette', + confirmdelete: (name: string) => `Er du sikker på at du vil slette${name ? ` ${name}` : ''}?`, confirmdisable: 'Er du sikker på du vil deaktivere', confirmremove: 'Er du sikker på at du vil fjerne', confirmremoveusageof: 'Er du sikker på du vil fjerne brugen af %0%', @@ -2249,6 +2249,8 @@ export default { labelForRemoveAllEntries: 'Fjern alle elementer', labelForClearClipboard: 'Ryd udklipsholder', labelForCopyToClipboard: 'Kopier til udklipsholder', + confirmDeleteHeadline: 'Slet fra udklipsholderen', + confirmDeleteDescription: 'Er du sikker på at du vil slette {0} fra udklipsholderen?', }, propertyActions: { tooltipForPropertyActionsMenu: 'Åben egenskabshandlinger', diff --git a/src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts b/src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts index abee3dfad2..de31a6992a 100644 --- a/src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts +++ b/src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts @@ -508,7 +508,6 @@ export default { anchorLinkPicker: 'Anchor or querystring', anchorInsert: 'Name', closeThisWindow: 'Close this window', - confirmdelete: 'Are you sure you want to delete', confirmdeleteNumberOfItems: 'Are you sure you want to delete %0% of %1% items', confirmdisable: 'Are you sure you want to disable', confirmremove: 'Are you sure you want to remove', diff --git a/src/Umbraco.Web.UI.Client/src/assets/lang/en.ts b/src/Umbraco.Web.UI.Client/src/assets/lang/en.ts index 58885ade29..b6bdae3a3b 100644 --- a/src/Umbraco.Web.UI.Client/src/assets/lang/en.ts +++ b/src/Umbraco.Web.UI.Client/src/assets/lang/en.ts @@ -497,7 +497,7 @@ export default { anchorLinkPicker: 'Anchor or querystring', anchorInsert: 'Name', closeThisWindow: 'Close this window', - confirmdelete: 'Are you sure you want to delete', + confirmdelete: (name: string) => `Are you sure you want to delete${name ? ` ${name}` : ''}?`, confirmdeleteNumberOfItems: 'Are you sure you want to delete %0% of %1% items', confirmdisable: 'Are you sure you want to disable', confirmremove: 'Are you sure you want to remove', @@ -2388,6 +2388,8 @@ export default { labelForRemoveAllEntries: 'Remove all items', labelForClearClipboard: 'Clear clipboard', labelForCopyToClipboard: 'Copy to clipboard', + confirmDeleteHeadline: 'Delete from clipboard', + confirmDeleteDescription: 'Are you sure you want to delete {0} from the clipboard?', }, propertyActions: { tooltipForPropertyActionsMenu: 'Open Property Actions', diff --git a/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.test.ts b/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.test.ts index 233bef12c9..18ef72ea3e 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.test.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.test.ts @@ -302,6 +302,20 @@ describe('UmbLocalizeController', () => { expect(controller.string({})).to.equal(''); expect(controller.string(undefined)).to.equal(''); }); + + it('should return an empty string if the input is an empty string', async () => { + expect(controller.string('')).to.equal(''); + }); + + it('should return the input string if the input is not prefixed with a #', async () => { + const str = 'close'; + expect(controller.string(str)).to.equal('close'); + }); + + it('should replace tokens in each key with the provided args', async () => { + const str = '#withInlineToken #withInlineTokenLegacy'; + expect(controller.string(str, 'value1', 'value2')).to.equal('value1 value2 value1 value2'); + }); }); describe('host element', () => { diff --git a/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.ts b/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.ts index 1c92265e91..d37b958fa5 100644 --- a/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/libs/localization-api/localization.controller.ts @@ -191,9 +191,10 @@ export class UmbLocalizationController { const key = match.slice(1); - // TODO: find solution to pass dynamic string to term + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - const localized = this.term(key); + const localized = this.term(key, ...args); // we didn't find a localized string, so we return the original string with the # return localized === key ? match : localized; }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/clipboard/clipboard-entry/detail/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/clipboard/clipboard-entry/detail/manifests.ts index f6a2cabd2a..753a8c58de 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/clipboard/clipboard-entry/detail/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/clipboard/clipboard-entry/detail/manifests.ts @@ -19,11 +19,15 @@ export const manifests: Array = [ type: 'entityAction', kind: 'delete', alias: 'Umb.EntityAction.ClipboardEntry.Delete', - name: 'Delete Dictionary Entry Entity Action', + name: 'Delete Clipboard Entry Entity Action', forEntityTypes: [UMB_CLIPBOARD_ENTRY_ENTITY_TYPE], meta: { itemRepositoryAlias: UMB_CLIPBOARD_ENTRY_ITEM_REPOSITORY_ALIAS, detailRepositoryAlias: UMB_CLIPBOARD_ENTRY_DETAIL_REPOSITORY_ALIAS, + confirm: { + headline: '#clipboard_confirmDeleteHeadline', + message: '#clipboard_confirmDeleteDescription', + }, }, }, ]; 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 e02b22e7f3..0fadb1aa78 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 @@ -5,9 +5,11 @@ import { createExtensionApiByAlias } from '@umbraco-cms/backoffice/extension-reg import { umbConfirmModal } from '@umbraco-cms/backoffice/modal'; import type { UmbDetailRepository, UmbItemRepository } from '@umbraco-cms/backoffice/repository'; import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; +import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; export class UmbDeleteEntityAction extends UmbEntityActionBase { // TODO: make base type for item and detail models + #localize = new UmbLocalizationController(this); override async execute() { if (!this.args.unique) throw new Error('Cannot delete an item without a unique identifier.'); @@ -21,12 +23,15 @@ export class UmbDeleteEntityAction extends UmbEntityActionBase>( diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/types.ts index e01e50df2b..840544de6f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/types.ts @@ -8,6 +8,10 @@ export interface ManifestEntityActionDeleteKind extends ManifestEntityAction { expect(items.length).to.equal(4); }); - it('sets all allowed draggable items to draggable', () => { + it('sets all allowed draggable items to draggable', async () => { const items = element.getSortableItems(); expect(items.length).to.equal(3); + await aTimeout(100); items.forEach((item) => { expect(item.draggable).to.be.true; }); }); - it('sets all disabled items non draggable', () => { + it('sets all disabled items non draggable', async () => { const items = element.getDisabledItems(); expect(items.length).to.equal(1); + await aTimeout(100); items.forEach((item) => { expect(item.draggable).to.be.false; }); @@ -138,9 +140,10 @@ describe('UmbSorterController', () => { }); describe('disable', () => { - it('sets all items to non draggable', () => { + it('sets all items to non draggable', async () => { element.sorter.disable(); const items = element.getAllItems(); + await aTimeout(100); items.forEach((item) => { expect(item.draggable).to.be.false; }); @@ -161,9 +164,10 @@ describe('UmbSorterController', () => { }); }); - it('sets all disabled items non draggable', () => { + it('sets all disabled items non draggable', async () => { const items = element.getDisabledItems(); expect(items.length).to.equal(1); + await aTimeout(100); items.forEach((item) => { expect(item.draggable).to.be.false; }); diff --git a/src/Umbraco.Web.UI.Client/utils/all-umb-consts/index.ts b/src/Umbraco.Web.UI.Client/utils/all-umb-consts/index.ts index b13b2d8689..9e118cfd5e 100644 --- a/src/Umbraco.Web.UI.Client/utils/all-umb-consts/index.ts +++ b/src/Umbraco.Web.UI.Client/utils/all-umb-consts/index.ts @@ -404,7 +404,7 @@ export const foundConsts = [{ }, { path: '@umbraco-cms/backoffice/user', - consts: ["UMB_CREATE_USER_CLIENT_CREDENTIAL_MODAL","UMB_CREATE_USER_CLIENT_CREDENTIAL_MODAL_ALIAS","UMB_USER_CLIENT_CREDENTIAL_REPOSITORY_ALIAS","UMB_USER_COLLECTION_ALIAS","UMB_USER_COLLECTION_REPOSITORY_ALIAS","UMB_USER_COLLECTION_CONTEXT","UMB_COLLECTION_VIEW_USER_TABLE","UMB_COLLECTION_VIEW_USER_GRID","UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS","UMB_USER_ALLOW_DELETE_CONDITION_ALIAS","UMB_USER_ALLOW_DISABLE_CONDITION_ALIAS","UMB_USER_ALLOW_ENABLE_CONDITION_ALIAS","UMB_USER_ALLOW_EXTERNAL_LOGIN_CONDITION_ALIAS","UMB_USER_ALLOW_MFA_CONDITION_ALIAS","UMB_USER_ALLOW_UNLOCK_CONDITION_ALIAS","UMB_USER_IS_DEFAULT_KIND_CONDITION_ALIAS","UMB_CREATE_USER_MODAL","UMB_CREATE_USER_SUCCESS_MODAL","UMB_CREATE_USER_MODAL_ALIAS","UMB_USER_ENTITY_TYPE","UMB_USER_ROOT_ENTITY_TYPE","UMB_INVITE_USER_MODAL","UMB_RESEND_INVITE_TO_USER_MODAL","UMB_INVITE_USER_REPOSITORY_ALIAS","UMB_USER_MFA_MODAL","UMB_USER_PICKER_MODAL","UMB_USER_WORKSPACE_PATH","UMB_USER_ROOT_WORKSPACE_PATH","UMB_USER_AVATAR_REPOSITORY_ALIAS","UMB_CHANGE_USER_PASSWORD_REPOSITORY_ALIAS","UMB_USER_CONFIG_REPOSITORY_ALIAS","UMB_USER_CONFIG_STORE_ALIAS","UMB_USER_CONFIG_STORE_CONTEXT","UMB_CURRENT_USER_CONFIG_STORE_CONTEXT","UMB_USER_DETAIL_REPOSITORY_ALIAS","UMB_USER_DETAIL_STORE_ALIAS","UMB_USER_DETAIL_STORE_CONTEXT","UMB_DISABLE_USER_REPOSITORY_ALIAS","UMB_ENABLE_USER_REPOSITORY_ALIAS","UMB_USER_ITEM_REPOSITORY_ALIAS","UMB_USER_ITEM_STORE_ALIAS","UMB_USER_ITEM_STORE_CONTEXT","UMB_NEW_USER_PASSWORD_REPOSITORY_ALIAS","UMB_UNLOCK_USER_REPOSITORY_ALIAS","UMB_USER_WORKSPACE_ALIAS","UMB_USER_WORKSPACE_CONTEXT","UMB_USER_ROOT_WORKSPACE_ALIAS"] + consts: ["UMB_CREATE_USER_CLIENT_CREDENTIAL_MODAL","UMB_CREATE_USER_CLIENT_CREDENTIAL_MODAL_ALIAS","UMB_USER_CLIENT_CREDENTIAL_REPOSITORY_ALIAS","UMB_USER_COLLECTION_ALIAS","UMB_USER_COLLECTION_REPOSITORY_ALIAS","UMB_USER_COLLECTION_CONTEXT","UMB_COLLECTION_VIEW_USER_TABLE","UMB_COLLECTION_VIEW_USER_GRID","UMB_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS","UMB_CURRENT_USER_ALLOW_CHANGE_PASSWORD_CONDITION_ALIAS","UMB_USER_ALLOW_DELETE_CONDITION_ALIAS","UMB_USER_ALLOW_DISABLE_CONDITION_ALIAS","UMB_USER_ALLOW_ENABLE_CONDITION_ALIAS","UMB_USER_ALLOW_EXTERNAL_LOGIN_CONDITION_ALIAS","UMB_USER_ALLOW_MFA_CONDITION_ALIAS","UMB_CURRENT_USER_ALLOW_MFA_CONDITION_ALIAS","UMB_USER_ALLOW_UNLOCK_CONDITION_ALIAS","UMB_USER_IS_DEFAULT_KIND_CONDITION_ALIAS","UMB_CREATE_USER_MODAL","UMB_CREATE_USER_SUCCESS_MODAL","UMB_CREATE_USER_MODAL_ALIAS","UMB_USER_ENTITY_TYPE","UMB_USER_ROOT_ENTITY_TYPE","UMB_INVITE_USER_MODAL","UMB_RESEND_INVITE_TO_USER_MODAL","UMB_INVITE_USER_REPOSITORY_ALIAS","UMB_USER_MFA_MODAL","UMB_USER_PICKER_MODAL","UMB_USER_WORKSPACE_PATH","UMB_USER_ROOT_WORKSPACE_PATH","UMB_USER_AVATAR_REPOSITORY_ALIAS","UMB_CHANGE_USER_PASSWORD_REPOSITORY_ALIAS","UMB_USER_CONFIG_REPOSITORY_ALIAS","UMB_USER_CONFIG_STORE_ALIAS","UMB_CURRENT_USER_CONFIG_REPOSITORY_ALIAS","UMB_CURRENT_USER_CONFIG_STORE_ALIAS","UMB_CURRENT_USER_CONFIG_STORE_CONTEXT","UMB_USER_CONFIG_STORE_CONTEXT","UMB_USER_DETAIL_REPOSITORY_ALIAS","UMB_USER_DETAIL_STORE_ALIAS","UMB_USER_DETAIL_STORE_CONTEXT","UMB_DISABLE_USER_REPOSITORY_ALIAS","UMB_ENABLE_USER_REPOSITORY_ALIAS","UMB_USER_ITEM_REPOSITORY_ALIAS","UMB_USER_ITEM_STORE_ALIAS","UMB_USER_ITEM_STORE_CONTEXT","UMB_NEW_USER_PASSWORD_REPOSITORY_ALIAS","UMB_UNLOCK_USER_REPOSITORY_ALIAS","UMB_USER_WORKSPACE_ALIAS","UMB_USER_WORKSPACE_CONTEXT","UMB_USER_ROOT_WORKSPACE_ALIAS"] }, { path: '@umbraco-cms/backoffice/utils',