From 95a182487131783fbd04fc56ed643445677930e9 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Wed, 26 Jul 2023 10:29:01 +0200 Subject: [PATCH] translation to your profile --- .../src/assets/lang/en.json | 3 ++ .../user-profile-app-profile.element.ts | 31 ++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/assets/lang/en.json b/src/Umbraco.Web.UI.Client/src/assets/lang/en.json index 6fa985e594..db19f6dd34 100644 --- a/src/Umbraco.Web.UI.Client/src/assets/lang/en.json +++ b/src/Umbraco.Web.UI.Client/src/assets/lang/en.json @@ -2,5 +2,8 @@ "general": { "logout": "Log out", "close": "Close" + }, + "user": { + "yourProfile": "Your profile" } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/current-user/user-profile-apps/user-profile-app-profile.element.ts b/src/Umbraco.Web.UI.Client/src/packages/users/current-user/user-profile-apps/user-profile-app-profile.element.ts index 7bc4c986fc..1692f0c9b2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/current-user/user-profile-apps/user-profile-app-profile.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/current-user/user-profile-apps/user-profile-app-profile.element.ts @@ -1,3 +1,4 @@ +import { UMB_LOCALIZATION_CONTEXT } from '@umbraco-cms/backoffice/localization-api'; import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UUITextStyles } from '@umbraco-cms/backoffice/external/uui'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -13,6 +14,15 @@ export class UmbUserProfileAppProfileElement extends UmbLitElement { @state() private _currentUser?: UmbLoggedInUser; + @state() + protected _labelYourProfile = 'Your profile'; + + @state() + protected _labelEditProfile = 'Edit your profile'; + + @state() + protected _labelChangePassword = 'Change your password'; + private _modalContext?: UmbModalManagerContext; private _auth?: typeof UMB_AUTH.TYPE; @@ -28,7 +38,15 @@ export class UmbUserProfileAppProfileElement extends UmbLitElement { this._observeCurrentUser(); }); - this._observeCurrentUser(); + this.consumeContext(UMB_LOCALIZATION_CONTEXT, (instance) => { + instance + .localizeMany(['user_yourProfile', 'user_editProfileLabel', 'user_changePasswordLabel']) + .subscribe((value) => { + this._labelYourProfile = value[0]; + this._labelEditProfile = value[1]; + this._labelChangePassword = value[2]; + }); + }); } private async _observeCurrentUser() { @@ -56,10 +74,13 @@ export class UmbUserProfileAppProfileElement extends UmbLitElement { render() { return html` - - Your profile - Edit - Change password + + + Edit profile + + + Change password + `; }