Merge pull request #2120 from umbraco/v14/bugfix/document-collection-create-localize

Bugfix: Localizes collection create action labels
This commit is contained in:
Lee Kelleher
2024-07-17 11:35:33 +01:00
committed by GitHub
8 changed files with 28 additions and 17 deletions

View File

@@ -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`
<uui-button
id="action-button"
@click=${this._onClick}
look="outline"
color="default"
label=${ifDefined(
this.manifest?.meta.label ? this.localize.string(this.manifest.meta.label) : this.manifest?.name,
)}
href="${ifDefined(this.manifest?.meta.href)}"
.state=${this._buttonState}></uui-button>
look="outline"
label=${ifDefined(label)}
href=${ifDefined(this.manifest?.meta.href)}
.state=${this._buttonState}
@click=${this._onClick}></uui-button>
`;
}
}

View File

@@ -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 {

View File

@@ -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: [

View File

@@ -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`
<uui-button color="default" href=${this.#getCreateUrl(item)} label=${label} look="outline"></uui-button>
@@ -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`
<uui-button popovertarget="collection-action-menu-popover" label=${label} color="default" look="outline">

View File

@@ -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: [
{

View File

@@ -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: [

View File

@@ -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`<uui-button
color="default"
@@ -119,8 +124,8 @@ export class UmbCreateMediaCollectionActionElement extends UmbLitElement {
if (!this._allowedMediaTypes.length) return;
const label = this.manifest?.meta.label
? this.localize.string(this.manifest.meta.label)
: this.manifest?.name ?? '';
? this.localize.string(this.manifest?.meta.label)
: this.localize.term('general_create');
return html`
<uui-button popovertarget="collection-action-menu-popover" label=${label} color="default" look="outline">

View File

@@ -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: [