From 0ff9158641366a58578af5369fddcb1413c87b5a Mon Sep 17 00:00:00 2001 From: Vinod Seraphin <45050678+vrseraphin@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:04:01 -0400 Subject: [PATCH] BUG-863783 - Locale support (#471) * BUG-863783 - Locale support * crcted the locale label value fetching from sessionStorage * updated the pega auth version --------- Co-authored-by: serav Co-authored-by: mashm --- package.json | 2 +- src/samples/FullPortal/index.tsx | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 88d03b87f..d61a9e406 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.60", "@material-ui/pickers": "^3.3.10", - "@pega/auth": "^0.2.2", + "@pega/auth": "^0.2.9", "@pega/cosmos-react-condition-builder": "^4.2.0", "@pega/cosmos-react-core": "^4.2.0", "@pega/cosmos-react-work": "^4.2.0", diff --git a/src/samples/FullPortal/index.tsx b/src/samples/FullPortal/index.tsx index 9752ddc0f..cee8fe2d2 100644 --- a/src/samples/FullPortal/index.tsx +++ b/src/samples/FullPortal/index.tsx @@ -33,6 +33,10 @@ export default function FullPortal() { const portalValue: any = query.get('portal'); sessionStorage.setItem('rsdk_portalName', portalValue); } + if (query.get('locale')) { + const localeOverride: any = query.get('locale'); + sessionStorage.setItem('rsdk_locale', localeOverride); + } // const outlet = document.getElementById("outlet"); @@ -161,8 +165,12 @@ export default function FullPortal() { function doRedirectDone() { history.push(window.location.pathname); + let localeOverride: any = sessionStorage.getItem('rsdk_locale'); + if (!localeOverride) { + localeOverride = undefined; + } // appName and mainRedirect params have to be same as earlier invocation - loginIfNecessary({ appName: 'portal', mainRedirect: true }); + loginIfNecessary({ appName: 'portal', mainRedirect: true, locale: localeOverride }); } // One time (initialization) @@ -171,11 +179,16 @@ export default function FullPortal() { // start the portal startPortal(); }); + let localeOverride: any = sessionStorage.getItem('rsdk_locale'); + if (!localeOverride) { + localeOverride = undefined; + } // Login if needed, doing an initial main window redirect loginIfNecessary({ appName: 'portal', mainRedirect: true, - redirectDoneCB: doRedirectDone + redirectDoneCB: doRedirectDone, + locale: localeOverride }); }, []);