Skip to content

Commit

Permalink
fix title, translate with slot
Browse files Browse the repository at this point in the history
  • Loading branch information
illfixit committed Sep 29, 2024
1 parent d7dfc1d commit b5ff049
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/app/routes/connector-ui/connector-ui.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export class ConnectorUiComponent implements OnInit {
) {
this.navItemGroups = this.navItemsBuilder.buildNavItemGroups();
this.translateService.setDefaultLang('en');
this.translateService.use(localStorage.getItem('selectedLanguage') || 'en');
let selectedLanguage = localStorage.getItem('selectedLanguage');
if (!selectedLanguage) {
selectedLanguage = 'en';
localStorage.setItem('selectedLanguage', selectedLanguage);
}
this.translateService.use(JSON.parse(selectedLanguage));
}

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="flex flex-row flex-wrap gap-[16px]">
<dashboard-kpi-card
class="flex-even-sized"
[label]="'dashboard_page.your_def' | translate"
[label]="'dashboard_page.your_data_offers' | translate"
[kpi]="data.numContractDefinitions"></dashboard-kpi-card>

<dashboard-kpi-card
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Input, OnChanges, OnDestroy} from '@angular/core';
import {Component, Input, OnChanges, OnDestroy, OnInit} from '@angular/core';
import {Subject, switchMap} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {TranslateService} from '@ngx-translate/core';
Expand All @@ -8,7 +8,9 @@ import {SimpleChangesTyped} from '../../../core/utils/angular-utils';
selector: 'translate-with-slot',
templateUrl: './translate-with-slot.component.html',
})
export class TranslateWithSlotComponent implements OnChanges, OnDestroy {
export class TranslateWithSlotComponent
implements OnInit, OnChanges, OnDestroy
{
@Input()
key!: string;

Expand All @@ -22,6 +24,14 @@ export class TranslateWithSlotComponent implements OnChanges, OnDestroy {
textAfter = '';

constructor(private translationService: TranslateService) {
this.splitText();
}

ngOnInit() {
this.splitText();
}

splitText() {
this.key$
.pipe(
switchMap(() => this.translationService.get(this.key)),
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
"dashboard_page.trans_pro": "Transfer Processes",
"dashboard_page.transfer": "Transfer History",
"dashboard_page.your_assets": "Your Assets",
"dashboard_page.your_data_offers": "Your Data Offers",
"dashboard_page.your_def": "Your Contract Definitions",
"dashboard_page.your_pol": "Your Policies",
"edit_asset_page.title": "Edit Asset",
Expand Down

0 comments on commit b5ff049

Please sign in to comment.