Skip to content

Commit 321ef6c

Browse files
committed
feat: use the action alias to generate the localization and fallback to alias if none is found
1 parent 6673805 commit 321ef6c

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/packages/documents/documents/entity-actions/notifications/modal/document-notifications-modal.element.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ export class UmbDocumentNotificationsModalElement extends UmbModalBaseElement<
1616
#unique?: UmbEntityUnique;
1717
#documentNotificationsRepository = new UmbDocumentNotificationsRepository(this);
1818

19-
#localizationKeys = [
20-
{ actionId: 'Umb.Document.Duplicate', key: 'actions_copy' },
21-
{ actionId: 'Umb.Document.Delete', key: 'actions_delete' },
22-
{ actionId: 'Umb.Document.Move', key: 'actions_move' },
23-
{ actionId: 'Umb.Document.Create', key: 'actions_create' },
24-
{ actionId: 'Umb.Document.PublicAccess', key: 'actions_protect' },
25-
{ actionId: 'Umb.Document.Publish', key: 'actions_publish' },
26-
{ actionId: 'Umb.DocumentRecycleBin.Restore', key: 'actions_restore' },
27-
{ actionId: 'Umb.Document.Permissions', key: 'actions_rights' },
28-
{ actionId: 'Umb.Document.Rollback', key: 'actions_rollback' },
29-
{ actionId: 'Umb.Document.Sort', key: 'actions_sort' },
30-
{ actionId: 'Umb.Document.SendForApproval', key: 'actions_sendtopublish' },
31-
{ actionId: 'Umb.Document.Update', key: 'actions_update' },
32-
];
33-
3419
@state()
3520
private _settings: UmbDocumentNotificationSettings = [];
3621

@@ -77,11 +62,16 @@ export class UmbDocumentNotificationsModalElement extends UmbModalBaseElement<
7762
this._settings,
7863
(setting) => setting.actionId,
7964
(setting) => {
80-
const localization = this.#localizationKeys.find((x) => x.actionId === setting.actionId);
65+
const localizationKey = `actions_${setting.alias}`;
66+
let localization = this.localize.term(localizationKey);
67+
if (localization === localizationKey) {
68+
// Fallback to alias if no localization is found
69+
localization = setting.alias;
70+
}
8171
return html`<uui-toggle
8272
id=${setting.actionId}
8373
@change=${() => this.#updateSubscription(setting.actionId)}
84-
.label=${localization ? this.localize.term(localization.key) : setting.actionId}
74+
.label=${localization}
8575
?checked=${setting.subscribed}></uui-toggle>`;
8676
},
8777
)}

0 commit comments

Comments
 (0)