Skip to content

Commit

Permalink
BUG-863783 - Locale support (#471)
Browse files Browse the repository at this point in the history
* BUG-863783 - Locale support

* crcted the locale label value fetching from sessionStorage

* updated the pega auth version

---------

Co-authored-by: serav <[email protected]>
Co-authored-by: mashm <[email protected]>
  • Loading branch information
3 people authored Apr 23, 2024
1 parent 94403f1 commit 0ff9158
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 15 additions & 2 deletions src/samples/FullPortal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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)
Expand All @@ -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
});
}, []);

Expand Down

0 comments on commit 0ff9158

Please sign in to comment.