Skip to content

Commit d19290a

Browse files
4manasamanasatumms2021389
authored
Added Localization fixes (#356)
Co-authored-by: manasa <[email protected]> Co-authored-by: tumms2021389 <[email protected]>
1 parent 23298c8 commit d19290a

File tree

13 files changed

+40
-31
lines changed

13 files changed

+40
-31
lines changed

packages/angular-sdk-components/src/lib/_components/infra/Containers/flow-container/flow-container.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
8989
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
9090

9191
this.localizedVal = PCore.getLocaleUtils().getLocaleValue;
92-
const caseInfo = this.pConn$.getCaseInfo();
93-
this.localeReference = `${caseInfo?.getClassName()}!CASE!${caseInfo.getName()}`.toUpperCase();
92+
this.localeReference = this.pConn$?.getCaseLocaleReference();
9493

9594
// Then, continue on with other initialization
9695

packages/angular-sdk-components/src/lib/_components/infra/Containers/modal-view-container/modal-view-container.component.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,7 @@ export class ModalViewContainerComponent implements OnInit, OnDestroy {
234234
this.title$ =
235235
isDataObject || this.isMultiRecord
236236
? this.getModalHeading(dataObjectAction)
237-
: this.determineModalHeaderByAction(
238-
actionName,
239-
caseTypeName,
240-
ID,
241-
`${theNewCaseInfo?.getClassName()}!CASE!${theNewCaseInfo.getName()}`.toUpperCase()
242-
);
237+
: this.determineModalHeaderByAction(actionName, caseTypeName, ID, this.createdViewPConn$?.getCaseLocaleReference());
243238

244239
const bIsRefComponent = this.checkIfRefComponent(newComp);
245240

packages/angular-sdk-components/src/lib/_components/infra/assignment/assignment.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
257257
this.prevNavigationSteps = JSON.parse(JSON.stringify(oCaseInfo.navigation.steps));
258258
this.arNavigationSteps$.forEach(step => {
259259
if (step.name) {
260-
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, this.localeReference);
260+
step.name = this.pConn$.getLocalizationService().getLocalizedText(step.name);
261261
}
262262
});
263263
this.arCurrentStepIndicies$ = [];

packages/angular-sdk-components/src/lib/_components/infra/navbar/navbar.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
*ngFor="let caseType of caseTypes$"
2323
(click)="navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType)"
2424
>
25-
<span class="psdk-nav-button-span">{{ localeUtils.getLocaleValue(caseType.pyLabel, '', localeReference) }}</span>
25+
<span class="psdk-nav-button-span">{{
26+
localeUtils.getLocaleValue(caseType.pyLabel, '', localeUtils.getCaseLocaleReference(caseType.pyClassName))
27+
}}</span>
2628
</mat-list-item>
2729
</mat-list>
2830
</mat-list>
@@ -32,7 +34,7 @@
3234
<mat-list-item (click)="navPanelButtonClick(page)">
3335
<div class="flex-box">
3436
<img class="psdk-nav-svg-icon" src="{{ page.iconName }}" />
35-
<span class="psdk-nav-button-span">{{ localeUtils.getLocaleValue(page.pyLabel, '', localeReference) }}</span>
37+
<span class="psdk-nav-button-span">{{ page.name }}</span>
3638
</div>
3739
</mat-list-item>
3840
</mat-list>

packages/angular-sdk-components/src/lib/_components/infra/navbar/navbar.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
4949
localizedVal: any;
5050
localeCategory = 'AppShell';
5151
localeUtils = PCore.getLocaleUtils();
52-
localeReference: any;
5352
constructor(
5453
private angularPConnect: AngularPConnectService,
5554
private chRef: ChangeDetectorRef,
@@ -113,11 +112,17 @@ export class NavbarComponent implements OnInit, OnDestroy {
113112

114113
// making a copy, so can add info
115114
this.navPages$ = JSON.parse(JSON.stringify(this.pages$));
116-
115+
// @ts-ignore
116+
const localeReference = PCore.getLocaleUtils().getPortalLocaleReference() || this.pConn$.getValue('.pyLocaleReference');
117117
this.navPages$.forEach(page => {
118+
const destinationObject: any = {};
119+
this.pConn$.resolveConfigProps(
120+
{ defaultHeading: page.pyDefaultHeading || page.pyLabel, localeReference: page.pyLocalizationReference },
121+
destinationObject
122+
);
123+
page.name = this.localeUtils.getLocaleValue(destinationObject.defaultHeading, '', destinationObject.localeReference || localeReference);
118124
page.iconName = this.utils.getImageSrc(page.pxPageViewIcon, this.utils.getSDKStaticContentUrl());
119125
});
120-
this.localeReference = this.pConn$.getValue('.pyLocaleReference');
121126
this.actionsAPI = this.pConn$.getActionsApi();
122127
this.createWork = this.actionsAPI.createWork.bind(this.actionsAPI);
123128
this.showPage = this.actionsAPI.showPage.bind(this.actionsAPI);

packages/angular-sdk-components/src/lib/_components/infra/stages/stages.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<img class="psdk-stages-icon" src="{{ checkSvgIcon$ }}" />{{ PCore$.getLocaleUtils().getLocaleValue(stage.name, '', key) }}
55
</div>
66
<div *ngIf="stage.visited_status == 'active'" class="psdk-stages-inner-present">
7-
{{ PCore$.getLocaleUtils().getLocaleValue(stage.name, '', key) }}
7+
{{ localizationService.getLocalizedText(stage.name) }}
88
</div>
99
<div *ngIf="stage.visited_status == 'future'" class="psdk-stages-inner-future">
10-
{{ PCore$.getLocaleUtils().getLocaleValue(stage.name, '', key) }}
10+
{{ localizationService.getLocalizedText(stage.name) }}
1111
</div>
1212
</div>
1313
</div>

packages/angular-sdk-components/src/lib/_components/infra/stages/stages.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class StagesComponent implements OnInit, OnDestroy {
2626
arStageResults$: any[];
2727
lastStage$: any;
2828
checkSvgIcon$: string;
29-
key: string;
29+
key: any;
30+
localizationService: any;
3031

3132
constructor(
3233
private angularPConnect: AngularPConnectService,
@@ -39,7 +40,8 @@ export class StagesComponent implements OnInit, OnDestroy {
3940

4041
// const imagePath = this.utils.getIconPath(this.utils.getSDKStaticContentUrl());
4142
this.checkSvgIcon$ = this.utils.getImageSrc('check', this.utils.getSDKStaticContentUrl());
42-
this.key = `${this.pConn$.getCaseInfo().getClassName()}!CASE!${this.pConn$.getCaseInfo().getName()}`.toUpperCase();
43+
this.key = this.pConn$?.getCaseLocaleReference();
44+
this.localizationService = this.pConn$?.getLocalizationService();
4345
}
4446

4547
ngOnDestroy(): void {

packages/angular-sdk-components/src/lib/_components/template/case-view/case-view.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class CaseViewComponent implements OnInit, OnDestroy {
134134
const timer = interval(100).subscribe(() => {
135135
timer.unsubscribe();
136136

137-
this.heading$ = PCore.getLocaleUtils().getLocaleValue(this.configProps$.header, '', this.localeKey);
137+
this.heading$ = this.pConn$.getLocalizationService().getLocalizedText(this.configProps$.header);
138138
this.id$ = this.configProps$.subheader;
139139
this.status$ = this.pConn$.getValue('.pyStatusWork');
140140
});

packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ <h3 *ngIf="label" class="label" style="font-weight: bold">
186186
</table>
187187
</div>
188188
<div class="psdk-no-records" *ngIf="repeatListData?.length === 0">
189-
{{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
189+
{{ utils.getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.') }}
190190
</div>
191191
</div>
192192
</div>

packages/angular-sdk-components/src/lib/_components/template/simple-table-manual/simple-table-manual.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h3 *ngIf="label" className="label" style="font-weight: bold">
5858
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
5959
<tr class="mat-row psdk-no-records" *matNoDataRow>
6060
<td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
61-
{{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
61+
{{ utils.getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.') }}
6262
</td>
6363
</tr>
6464
</table>
@@ -90,7 +90,7 @@ <h3 *ngIf="label" className="label" style="font-weight: bold">
9090
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
9191
<tr class="mat-row psdk-no-records" *matNoDataRow>
9292
<td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
93-
{{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
93+
{{ utils.getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.') }}
9494
</td>
9595
</tr>
9696
</table>

0 commit comments

Comments
 (0)