From 32a2de69c101bfb39db409d741d47c761a703667 Mon Sep 17 00:00:00 2001
From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Date: Tue, 25 Jul 2023 16:09:50 +0200
Subject: [PATCH] add label localization
---
.../current-user-modal.element.ts | 22 +++++++++++++------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/current-user/modals/current-user/current-user-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/current-user/modals/current-user/current-user-modal.element.ts
index 660641e7f2..9f2722005a 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/users/current-user/modals/current-user/current-user-modal.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/users/current-user/modals/current-user/current-user-modal.element.ts
@@ -1,3 +1,4 @@
+import { UMB_LOCALIZATION_CONTEXT } from '@umbraco-cms/backoffice/localization-api';
import { UMB_AUTH, type UmbLoggedInUser } from '@umbraco-cms/backoffice/auth';
import { UMB_APP } from '@umbraco-cms/backoffice/context';
import { UUITextStyles } from '@umbraco-cms/backoffice/external/uui';
@@ -10,6 +11,12 @@ export class UmbCurrentUserModalElement extends UmbLitElement {
@property({ attribute: false })
modalContext?: UmbModalContext;
+ @state()
+ protected labelClose = 'Close';
+
+ @state()
+ protected labelLogout = 'Log out';
+
@state()
private _currentUser?: UmbLoggedInUser;
@@ -25,15 +32,16 @@ export class UmbCurrentUserModalElement extends UmbLitElement {
this._observeCurrentUser();
});
- this.consumeContext(UMB_AUTH, (instance) => {
- this.#auth = instance;
- });
-
this.consumeContext(UMB_APP, (instance) => {
this.#appContext = instance;
});
- this._observeCurrentUser();
+ this.consumeContext(UMB_LOCALIZATION_CONTEXT, (instance) => {
+ instance.localizeMany(['general_close', 'general_logout']).subscribe((values) => {
+ if (values['general_close']) this.labelClose = values['general_close'];
+ if (values['general_logout']) this.labelLogout = values['general_logout'];
+ });
+ });
}
private async _observeCurrentUser() {
@@ -64,10 +72,10 @@ export class UmbCurrentUserModalElement extends UmbLitElement {