Skip to content

Commit 289b95c

Browse files
4manasamanasa
andauthored
Step name localization issue fixed (#163)
Co-authored-by: manasa <[email protected]>
1 parent 3afead7 commit 289b95c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function Assignment(props) {
2121
const actionsAPI = thePConn.getActionsApi();
2222
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
2323
const localeCategory = 'Assignment';
24+
const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
2425

2526
// store off bound functions to above pointers
2627
const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
@@ -92,8 +93,13 @@ export default function Assignment(props) {
9293
} else {
9394
setIsVertical(false);
9495
}
95-
96-
setArNavigationSteps(JSON.parse(JSON.stringify(oCaseInfo.navigation.steps)));
96+
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
97+
steps.forEach(step => {
98+
if (step.name) {
99+
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
100+
}
101+
});
102+
setArNavigationSteps(steps);
97103
setArCurrentStepIndicies(
98104
findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0)
99105
);

packages/react-sdk-components/src/components/infra/Containers/FlowContainer/FlowContainer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export default function FlowContainer(props) {
8787
const [bShowConfirm, setShowConfirm] = useState(false);
8888
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
8989
const localeCategory = 'Messages';
90+
const caseInfo = getPConnect().getCaseInfo();
91+
const localeReference = `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase();
9092

9193
const classes = useStyles();
9294

@@ -181,7 +183,7 @@ export default function FlowContainer(props) {
181183

182184
if (bLoadChildren && oWorkData) {
183185
// debugger;
184-
setContainerName(oWorkData.caseInfo.assignments?.[0].name);
186+
setContainerName(localizedVal(oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
185187
}
186188

187189
// debugger;
@@ -405,7 +407,7 @@ export default function FlowContainer(props) {
405407
// check if have oWorkData, there are times due to timing of state change, when this
406408
// may not be available
407409
if (oWorkData) {
408-
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
410+
setContainerName(localizedVal(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name, undefined, localeReference));
409411
}
410412
}
411413
}

packages/react-sdk-components/src/components/template/CaseView/CaseView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default function CaseView(props) {
7373

7474
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
7575
const localeCategory = 'CaseView';
76+
const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
7677

7778
/**
7879
*
@@ -222,7 +223,7 @@ export default function CaseView(props) {
222223
className={classes.caseViewHeader}
223224
title={
224225
<Typography variant='h6' component='div'>
225-
{header}
226+
{PCore.getLocaleUtils().getLocaleValue(header, '', localeKey)}
226227
</Typography>
227228
}
228229
subheader={

0 commit comments

Comments
 (0)