From 1c26b33b8f3327f632eaa8fdebe24f9a6271f9cf Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 17 Jul 2024 10:02:00 +0100 Subject: [PATCH 1/3] Bugfix: Localizes document collection create action --- .../action/collection-action-button.element.ts | 13 ++++++------- .../src/packages/core/collection/types.ts | 2 +- .../create-document-collection-action.element.ts | 11 +++++++++-- .../documents/collection/action/manifests.ts | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/action/collection-action-button.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/action/collection-action-button.element.ts index 4831180c80..6e33b5d692 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/action/collection-action-button.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/action/collection-action-button.element.ts @@ -65,17 +65,16 @@ export class UmbCollectionActionButtonElement extends UmbLitElement { } override render() { + const label = this.manifest?.meta.label ? this.localize.string(this.manifest.meta.label) : this.manifest?.name; return html` + look="outline" + label=${ifDefined(label)} + href=${ifDefined(this.manifest?.meta.href)} + .state=${this._buttonState} + @click=${this._onClick}> `; } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts b/src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts index ecd2225151..822d309abe 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts @@ -1,5 +1,5 @@ -import type { ManifestCollection } from '@umbraco-cms/backoffice/extension-registry'; import type { Observable } from '@umbraco-cms/backoffice/external/rxjs'; +import type { ManifestCollection } from '@umbraco-cms/backoffice/extension-registry'; import type { UmbPaginationManager } from '@umbraco-cms/backoffice/utils'; export interface UmbCollectionBulkActionPermissions { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/create-document-collection-action.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/create-document-collection-action.element.ts index 0e39f542dc..50a05f3eb5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/create-document-collection-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/create-document-collection-action.element.ts @@ -112,7 +112,12 @@ export class UmbCreateDocumentCollectionActionElement extends UmbLitElement { if (this._allowedDocumentTypes.length !== 1) return; const item = this._allowedDocumentTypes[0]; - const label = (this.manifest?.meta.label ?? this.localize.term('general_create')) + ' ' + item.name; + const label = + (this.manifest?.meta.label + ? this.localize.string(this.manifest?.meta.label) + : this.localize.term('general_create')) + + ' ' + + item.name; return html` @@ -122,7 +127,9 @@ export class UmbCreateDocumentCollectionActionElement extends UmbLitElement { #renderDropdown() { if (!this._allowedDocumentTypes.length) return; - const label = this.manifest?.meta.label ?? this.localize.term('general_create'); + const label = this.manifest?.meta.label + ? this.localize.string(this.manifest?.meta.label) + : this.localize.term('general_create'); return html` diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/manifests.ts index 93063e75bd..23e86e6e81 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/action/manifests.ts @@ -9,7 +9,7 @@ export const createManifest: ManifestCollectionAction = { element: () => import('./create-document-collection-action.element.js'), weight: 100, meta: { - label: 'Create', + label: '#general_create', }, conditions: [ { From ccffee7e3204306f8fa37bbcf372d2897aba8417 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 17 Jul 2024 10:09:25 +0100 Subject: [PATCH 2/3] Corrected media collection create action label localization --- .../action/create-media-collection-action.element.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection/action/create-media-collection-action.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection/action/create-media-collection-action.element.ts index f0ac1e340c..349aef3f0d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/collection/action/create-media-collection-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/collection/action/create-media-collection-action.element.ts @@ -106,7 +106,12 @@ export class UmbCreateMediaCollectionActionElement extends UmbLitElement { if (this._allowedMediaTypes.length !== 1) return; const item = this._allowedMediaTypes[0]; - const label = (this.manifest?.meta.label ?? this.localize.term('general_create')) + ' ' + item.name; + const label = + (this.manifest?.meta.label + ? this.localize.string(this.manifest?.meta.label) + : this.localize.term('general_create')) + + ' ' + + item.name; return html` From 304ec952e7a1ec97770e9cef784a6f2da5913dc5 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 17 Jul 2024 10:10:03 +0100 Subject: [PATCH 3/3] Localized the remaining 'collectionAction' labels --- .../src/packages/dictionary/collection/action/manifests.ts | 2 +- .../src/packages/language/collection/action/manifests.ts | 2 +- .../src/packages/webhook/collection/action/manifests.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/action/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/action/manifests.ts index 7fa77c8610..d6b73b5834 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/action/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/action/manifests.ts @@ -9,7 +9,7 @@ export const createManifest: ManifestCollectionAction = { alias: 'Umb.CollectionAction.Dictionary.Create', weight: 200, meta: { - label: 'Create', + label: '#general_create', href: `section/dictionary/workspace/dictionary/create/parent/${UMB_DICTIONARY_ROOT_ENTITY_TYPE}/null`, }, conditions: [ diff --git a/src/Umbraco.Web.UI.Client/src/packages/language/collection/action/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/language/collection/action/manifests.ts index 4dfa891fbe..bf76be9c0d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/language/collection/action/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/language/collection/action/manifests.ts @@ -8,7 +8,7 @@ export const createManifest: ManifestCollectionAction = { alias: 'Umb.CollectionAction.Language.Create', weight: 200, meta: { - label: 'Create', + label: '#general_create', href: 'section/settings/workspace/language/create', }, conditions: [ diff --git a/src/Umbraco.Web.UI.Client/src/packages/webhook/collection/action/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/webhook/collection/action/manifests.ts index 241ef08add..219c359da4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/webhook/collection/action/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/webhook/collection/action/manifests.ts @@ -8,7 +8,7 @@ export const createManifest: ManifestCollectionAction = { alias: 'Umb.CollectionAction.Webhook.Create', weight: 200, meta: { - label: 'Create', + label: '#general_create', href: 'section/settings/workspace/webhook/create', }, conditions: [