Skip to content

Commit d164ce1

Browse files
committed
refactor: Translate strings on dialog components
1 parent 0ca961d commit d164ce1

File tree

20 files changed

+46
-138
lines changed

20 files changed

+46
-138
lines changed

projects/hslayers/common/confirm/confirm-dialog.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<div class="modal-content">
44
<div class="modal-header">
55
<h4 class="modal-title">
6-
{{data.title}}
6+
{{data.title | translateHs}}
77
</h4>
88
<button type="button" (click)="no()" class="btn-close" data-dismiss="modal"
99
[attr.aria-label]="'COMMON.close' | translateHs "></button>
1010
</div>
1111
<div class="modal-body" style="overflow-y:auto">
12-
<p class="fw-bold h6">{{data.message}}</p>
13-
<p class="h6 small">{{data.note}}</p>
12+
<p class="fw-bold h6">{{data.message | translateHs}}</p>
13+
<p class="h6 small">{{data.note | translateHs}}</p>
1414
</div>
1515
<div class="modal-footer">
1616
<button type="button" class="btn btn-primary" (click)="yes()" [title]="'COMMON.yes' | translateHs"

projects/hslayers/common/confirm/confirm-dialog.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import {
55
HsDialogContainerService,
66
HsDialogItem,
77
} from 'hslayers-ng/common/dialogs';
8+
import {TranslateCustomPipe} from 'hslayers-ng/shared/language';
89

910
@Component({
1011
selector: 'hs-confirm-dialog',
1112
templateUrl: './confirm-dialog.component.html',
13+
standalone: true,
14+
imports: [TranslateCustomPipe],
1215
})
1316
export class HsConfirmDialogComponent implements HsDialogComponent {
1417
dialogItem: HsDialogItem;

projects/hslayers/common/confirm/confirm.module.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from './confirm-dialog.component';
2-
export * from './confirm.module';

projects/hslayers/common/dialogs/compositions-warning/warning-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h4 class="modal-title">{{'COMMON.warning' | translateHs }}</h4>
1010
<div class="modal-body" style="max-height: 600px; overflow-y: auto">
1111
<br>{{'COMMON.name' | translateHs }}: <b>{{data.composition_title}}</b>
1212
<hr>
13-
<br>{{data.message}}
13+
<br>{{data.message | translateHs}}
1414
<br>{{'COMPOSITIONS.dialogWarning.toContinue' | translateHs }}
1515
</div>
1616
<div class="modal-footer">

projects/hslayers/common/query-popup/widgets/clear-layer.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import {getTitle} from 'hslayers-ng/common/extensions';
1818
})
1919
export class HsClearLayerComponent
2020
extends HsQueryPopupWidgetBaseComponent
21-
implements OnInit
22-
{
21+
implements OnInit {
2322
@Input() data: {
2423
layerDescriptor: any;
2524
service: HsQueryPopupServiceModel;
@@ -48,10 +47,7 @@ export class HsClearLayerComponent
4847
message: this.hsLanguageService
4948
.getTranslation('QUERY.reallyDeleteAllFeaturesFrom', undefined)
5049
.replace('{0}', getTitle(layer)),
51-
title: this.hsLanguageService.getTranslation(
52-
'QUERY.confirmClear',
53-
undefined,
54-
),
50+
title: 'QUERY.confirmClear',
5551
},
5652
);
5753
const confirmed = await dialog.waitResult();

projects/hslayers/common/query-popup/widgets/feature-info.component.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import {
2424
})
2525
export class HsFeatureInfoComponent
2626
extends HsQueryPopupWidgetBaseComponent
27-
implements OnInit
28-
{
27+
implements OnInit {
2928
layerDescriptor: any;
3029
attributesForHover: any[] = [];
3130
name = 'feature-info';
@@ -84,14 +83,8 @@ export class HsFeatureInfoComponent
8483
const dialog = this.hsDialogContainerService.create(
8584
HsConfirmDialogComponent,
8685
{
87-
message: this.hsLanguageService.getTranslation(
88-
'QUERY.reallyDelete',
89-
undefined,
90-
),
91-
title: this.hsLanguageService.getTranslation(
92-
'QUERY.confirmDelete',
93-
undefined,
94-
),
86+
message: 'QUERY.reallyDelete',
87+
title: 'QUERY.confirmDelete',
9588
},
9689
);
9790
const confirmed = await dialog.waitResult();

projects/hslayers/common/remove-multiple/remove-layer-dialog.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="modal-content">
44
<div class="modal-header">
55
<h4 class="modal-title">
6-
{{data.title}}
6+
{{data.title | translateHs}}
77
</h4>
88
<button type="button" (click)="no()" class="btn-close" data-dismiss="modal"
99
[attr.aria-label]="'COMMON.close' | translateHs "></button>
@@ -19,9 +19,9 @@ <h4 class="modal-title">
1919
option)}}</button>
2020
</div>
2121
</div>
22-
<p *ngIf="deleteFrom === 'catalogue'" class="h6 small">{{data.note}}</p>
22+
<p *ngIf="deleteFrom === 'catalogue'" class="h6 small">{{data.note | translateHs}}</p>
2323
<div *ngIf="deleteFrom && data.multiple">
24-
<p class="fw-bold h6">{{data.message}}</p>
24+
<p class="fw-bold h6">{{data.message | translateHs}}</p>
2525

2626
<div style="max-height: 65vh;" *ngIf="data.items?.length > 0">
2727
<div class="d-flex w-100 justify-content-center">

projects/hslayers/common/remove-multiple/remove-layer-dialog.service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export class HsRemoveLayerDialogService {
3636
HsRmLayerDialogComponent,
3737
{
3838
multiple: false,
39-
message: this.translate('DRAW.reallyDeleteThisLayer'),
39+
message: 'DRAW.reallyDeleteThisLayer',
4040
note: this.getDeleteNote(),
41-
title: this.translate('COMMON.confirmDelete'),
41+
title: 'COMMON.confirmDelete',
4242
},
4343
);
4444
const confirmed: HsRmLayerDialogResponse = await dialog.waitResult();
@@ -65,9 +65,9 @@ export class HsRemoveLayerDialogService {
6565
HsRmLayerDialogComponent,
6666
{
6767
multiple: true,
68-
message: this.translate('DRAW.pleaseCheckTheLayers'),
68+
message: 'DRAW.pleaseCheckTheLayers',
6969
note: this.getDeleteNote(true),
70-
title: this.translate('COMMON.selectAndConfirmToDeleteMultiple'),
70+
title: 'COMMON.selectAndConfirmToDeleteMultiple',
7171
items: items,
7272
},
7373
);
@@ -151,7 +151,9 @@ export class HsRemoveLayerDialogService {
151151

152152
getDeleteNote(plural?: boolean): string {
153153
return this.hsDrawService.isAuthenticated
154-
? this.translate(plural ? 'DRAW.deleteNotePlural' : 'DRAW.deleteNote')
154+
? plural
155+
? 'DRAW.deleteNotePlural'
156+
: 'DRAW.deleteNote'
155157
: '';
156158
}
157159
}

projects/hslayers/components/add-data/add-data.component.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {HsAddDataUrlService} from 'hslayers-ng/shared/add-data';
88
import {HsDialogContainerService} from 'hslayers-ng/common/dialogs';
99
import {HsEventBusService} from 'hslayers-ng/shared/event-bus';
1010
import {HsGetCapabilitiesErrorComponent} from './common/capabilities-error-dialog/capabilities-error-dialog.component';
11-
import {HsLanguageService} from 'hslayers-ng/shared/language';
1211
import {HsLayoutService} from 'hslayers-ng/shared/layout';
1312
import {HsPanelBaseComponent} from 'hslayers-ng/common/panels';
1413
import {HsShareUrlService} from 'hslayers-ng/components/share';
@@ -26,7 +25,6 @@ export class HsAddDataComponent
2625

2726
constructor(
2827
public hsAddDataService: HsAddDataService,
29-
public hsLanguageService: HsLanguageService,
3028
public hsShareUrlService: HsShareUrlService,
3129
public hsLayoutService: HsLayoutService,
3230
public hsEventBusService: HsEventBusService,
@@ -59,23 +57,11 @@ export class HsAddDataComponent
5957
.subscribe((e) => {
6058
let error = e.toString();
6159
if (error?.includes('Unsuccessful OAuth2')) {
62-
error = this.hsLanguageService.getTranslationIgnoreNonExisting(
63-
'COMMON',
64-
'Authentication failed. Login to the catalogue.',
65-
undefined,
66-
);
60+
error = 'COMMON.Authentication failed. Login to the catalogue.';
6761
} else if (error.includes('property')) {
68-
error = this.hsLanguageService.getTranslationIgnoreNonExisting(
69-
'ADDLAYERS',
70-
'serviceTypeNotMatching',
71-
undefined,
72-
);
62+
error = 'ADDLAYERS.serviceTypeNotMatching';
7363
} else {
74-
error = this.hsLanguageService.getTranslationIgnoreNonExisting(
75-
'ADDLAYERS',
76-
error,
77-
undefined,
78-
);
64+
error = `ADDLAYERS.${error}`;
7965
}
8066
this.hsDialogContainerService.create(HsGetCapabilitiesErrorComponent, {
8167
error: error,

projects/hslayers/components/add-data/catalogue/catalogue-list-item/catalogue-list-item.component.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,9 @@ export class HsCatalogueListItemComponent implements OnInit {
207207
const dialog = this.hsDialogContainerService.create(
208208
HsConfirmDialogComponent,
209209
{
210-
message: this.hsLanguageService.getTranslation(
211-
'DRAW.reallyDeleteThisLayer',
212-
undefined,
213-
),
214-
note: this.hsLanguageService.getTranslation(
215-
'DRAW.deleteNote',
216-
undefined,
217-
),
218-
title: this.hsLanguageService.getTranslation(
219-
'COMMON.confirmDelete',
220-
undefined,
221-
),
210+
message: 'DRAW.reallyDeleteThisLayer',
211+
note: 'DRAW.deleteNote',
212+
title: 'COMMON.confirmDelete',
222213
},
223214
);
224215
const confirmed = await dialog.waitResult();

projects/hslayers/components/add-data/common/capabilities-error-dialog/capabilities-error-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h4 class="modal-title text-uppercase">
1010
</div>
1111
<div class="modal-body" style="max-height:600px; overflow-y:auto">
1212
<p>{{'ADDLAYERS.ERROR.thereWasErrorWhile' | translateHs }}</p>
13-
<p>{{data.error}}</p>
13+
<p>{{data.error | translateHs}}</p>
1414
</div>
1515
<div class="modal-footer">
1616
<button type="button" class="btn btn-secondary" (click)="close()" data-dismiss="modal">{{'COMMON.close'

projects/hslayers/components/layer-manager/dialogs/copy-layer-dialog.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<div class="modal-content">
44
<div class="modal-header">
55
<h4 class="modal-title">
6-
{{data.title}}
6+
{{data.title | translateHs}} ?
77
</h4>
88
<button type="button" (click)="no()" class="btn-close" data-dismiss="modal"
99
[attr.aria-label]="'COMMON.close' | translateHs"></button>
1010
</div>
1111
<div class="modal-body" style="overflow-y:auto">
12-
<p class="fw-bold h6">{{data.message}}</p>
12+
<p class="fw-bold h6">{{data.message | translateHs}}</p>
1313
<div class="form-floating m-2">
1414
<input class="form-control" name="title" [(ngModel)]="data.layerTitle"
1515
[placeholder]="'COMMON.title' | translateHs" />

projects/hslayers/components/layer-manager/editor/layer-editor.component.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {HsDrawService} from 'hslayers-ng/shared/draw';
1515
import {HsEventBusService} from 'hslayers-ng/shared/event-bus';
1616
import {HsExtentWidgetComponent} from '../widgets/extent-widget/extent-widget.component';
1717
import {HsIdwWidgetComponent} from '../widgets/idw-widget.component';
18-
import {HsLanguageService} from 'hslayers-ng/shared/language';
1918
import {HsLayerDescriptor} from 'hslayers-ng/types';
2019
import {HsLayerEditorDimensionsComponent} from '../dimensions/layer-editor-dimensions.component';
2120
import {HsLayerEditorService} from './layer-editor.service';
@@ -74,7 +73,6 @@ export class HsLayerEditorComponent {
7473
public HsDrawService: HsDrawService,
7574
public HsEventBusService: HsEventBusService,
7675
public HsDialogContainerService: HsDialogContainerService,
77-
public HsLanguageService: HsLanguageService,
7876
public hsWidgetContainerService: HsLayerEditorWidgetContainerService,
7977
) {}
8078

@@ -104,15 +102,8 @@ export class HsLayerEditorComponent {
104102
const dialog = this.HsDialogContainerService.create(
105103
HsConfirmDialogComponent,
106104
{
107-
message:
108-
this.HsLanguageService.getTranslation(
109-
'LAYERMANAGER.layerEditor.savegeojson',
110-
undefined,
111-
) + '?',
112-
title: this.HsLanguageService.getTranslation(
113-
'COMMON.confirm',
114-
undefined,
115-
),
105+
message: 'LAYERMANAGER.layerEditor.savegeojson',
106+
title: 'COMMON.confirm',
116107
},
117108
);
118109
const confirmed = await dialog.waitResult();
@@ -248,15 +239,8 @@ export class HsLayerEditorComponent {
248239
const dialog = this.HsDialogContainerService.create(
249240
HsCopyLayerDialogComponent,
250241
{
251-
message:
252-
this.HsLanguageService.getTranslation(
253-
'LAYERMANAGER.layerEditor.copyLayer',
254-
undefined,
255-
) + '?',
256-
title: this.HsLanguageService.getTranslation(
257-
'COMMON.copyLayer',
258-
undefined,
259-
),
242+
message: 'LAYERMANAGER.layerEditor.copyLayer',
243+
title: 'COMMON.copyLayer',
260244
layerTitle: getTitle(this.currentLayer.layer),
261245
},
262246
);

projects/hslayers/components/layer-manager/widgets/wms-source-widget/wms-source-widget.component.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import {Image as ImageLayer, Tile} from 'ol/layer';
66
import {ImageWMS, TileWMS} from 'ol/source';
77

88
import {HsConfirmDialogComponent} from 'hslayers-ng/common/confirm';
9-
import {HsConfirmModule} from 'hslayers-ng/common/confirm';
109
import {HsDialogContainerService} from 'hslayers-ng/common/dialogs';
11-
import {HsLanguageService} from 'hslayers-ng/shared/language';
1210
import {HsLayerEditorWidgetBaseComponent} from '../layer-editor-widget-base.component';
1311
import {HsLayerSelectorService} from 'hslayers-ng/shared/layer-manager';
1412
import {HsLayerShiftingService} from 'hslayers-ng/shared/layer-shifting';
@@ -20,7 +18,7 @@ import {TranslateCustomPipe} from 'hslayers-ng/shared/language';
2018
@Component({
2119
selector: 'hs-wms-source-widget',
2220
standalone: true,
23-
imports: [CommonModule, NgFor, HsConfirmModule, TranslateCustomPipe],
21+
imports: [CommonModule, NgFor, HsConfirmDialogComponent, TranslateCustomPipe],
2422
templateUrl: './wms-source-widget.component.html',
2523
})
2624
export class HsWmsSourceWidgetComponent extends HsLayerEditorWidgetBaseComponent {
@@ -36,7 +34,6 @@ export class HsWmsSourceWidgetComponent extends HsLayerEditorWidgetBaseComponent
3634
private hsMapService: HsMapService,
3735
private hsLayerShiftingService: HsLayerShiftingService,
3836
private hsDialogContainerService: HsDialogContainerService,
39-
private hsLanguageService: HsLanguageService,
4037
) {
4138
super(hsLayerSelectorService);
4239
this.isEnabled = this.layerDescriptor.pipe(
@@ -63,18 +60,9 @@ export class HsWmsSourceWidgetComponent extends HsLayerEditorWidgetBaseComponent
6360
const dialog = this.hsDialogContainerService.create(
6461
HsConfirmDialogComponent,
6562
{
66-
message: this.hsLanguageService.getTranslation(
67-
'LAYERMANAGER.layerEditor.changeLayerType',
68-
undefined,
69-
),
70-
note: this.hsLanguageService.getTranslation(
71-
'LAYERMANAGER.layerEditor.layerTypeChangeNote',
72-
undefined,
73-
),
74-
title: this.hsLanguageService.getTranslation(
75-
'LAYERMANAGER.layerEditor.confirmLayerTypeChange',
76-
undefined,
77-
),
63+
message: 'LAYERMANAGER.layerEditor.changeLayerType',
64+
note: 'LAYERMANAGER.layerEditor.layerTypeChangeNote',
65+
title: 'LAYERMANAGER.layerEditor.confirmLayerTypeChange',
7866
},
7967
);
8068
const confirmed = await dialog.waitResult();

projects/hslayers/components/query/feature-list/feature-list.component.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {Geometry} from 'ol/geom';
66
import {HsConfirmDialogComponent} from 'hslayers-ng/common/confirm';
77
import {HsDialogContainerService} from 'hslayers-ng/common/dialogs';
88
import {HsFeatureCommonService} from '../feature-common.service';
9-
import {HsLanguageService} from 'hslayers-ng/shared/language';
10-
import {HsLayerUtilsService} from 'hslayers-ng/shared/utils';
119
import {HsQueryBaseService} from 'hslayers-ng/shared/query';
1210
import {HsQueryVectorService} from 'hslayers-ng/shared/query';
1311
import {exportFormats} from '../feature-common.service';
@@ -36,10 +34,8 @@ export class HsQueryFeatureListComponent {
3634

3735
constructor(
3836
private hsQueryVectorService: HsQueryVectorService,
39-
private hsLanguageService: HsLanguageService,
4037
private hsDialogContainerService: HsDialogContainerService,
4138
public hsFeatureCommonService: HsFeatureCommonService,
42-
private hsLayerUtilsService: HsLayerUtilsService,
4339
public hsQueryBaseService: HsQueryBaseService,
4440
) {}
4541

@@ -125,14 +121,8 @@ export class HsQueryFeatureListComponent {
125121
const dialog = this.hsDialogContainerService.create(
126122
HsConfirmDialogComponent,
127123
{
128-
message: this.hsLanguageService.getTranslation(
129-
'QUERY.reallyDeleteAllSelectedLayers',
130-
undefined,
131-
),
132-
title: this.hsLanguageService.getTranslation(
133-
'COMMON.confirmDelete',
134-
undefined,
135-
),
124+
message: 'QUERY.reallyDeleteAllSelectedLayers',
125+
title: 'COMMON.confirmDelete',
136126
},
137127
);
138128
const confirmed = await dialog.waitResult();

0 commit comments

Comments
 (0)