diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts index e557ecc..3469487 100644 --- a/frontend/src/app/data.service.ts +++ b/frontend/src/app/data.service.ts @@ -19,6 +19,7 @@ export class DataService { private contracts: any []; private paketTypes: any []; private totalSize: number = null; + public selectedLanguage: string = 'DE'; /** * This constructor builds the dataService and fetches the states from the backend * @param http @@ -296,11 +297,21 @@ export class DataService { } getStateNameById(stateNr): String { - for (let state of this.states) { - if(stateNr == state.actualState){ - return state.stateNameDE; - } + if(this.selectedLanguage == 'EN'){ + for (let state of this.states) { + if(stateNr == state.actualState){ + return state.stateNameEN; + } + } } + if(this.selectedLanguage == 'DE'){ + for (let state of this.states) { + if(stateNr == state.actualState){ + return state.stateNameDE; + } + } + } + return ""; } diff --git a/frontend/src/ntt-gantt/ntt-gantt.component.ts b/frontend/src/ntt-gantt/ntt-gantt.component.ts index 85a2fc7..e1c0831 100644 --- a/frontend/src/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/ntt-gantt/ntt-gantt.component.ts @@ -142,14 +142,20 @@ export class NttGanttComponent implements OnInit { this.deMap.set('field1', 'Kurzbeschreibung'); this.enMap.set('field1', 'Summary'); this.deMap.set('dateRangeLabel', 'Datumsbereich auswählen'); - this.enMap.set('dateRangeLabel', 'Select Date Range') + this.enMap.set('dateRangeLabel', 'Select Date Range'); + if(navigator.language=='de-DE'){ + this.language = 'DE'; + }else{ + this.language = 'EN'; + } - this.initLanguge(); + this.initLanguge(true); } - initLanguge(){ + initLanguge(initial: boolean = false){ if(this.language == 'DE'){ + this.dataService.selectedLanguage = 'DE'; this.lMap = this.deMap; this.scalars = ['Woche-Tag', 'Monat-Woche', 'Jahr-Monat']; this.selectedScalar = 'Monat-Woche'; @@ -162,6 +168,7 @@ export class NttGanttComponent implements OnInit { ] } else{ + this.dataService.selectedLanguage = 'EN'; this.lMap = this.enMap; this.scalars = ['Week-Day', 'Month-Week', 'Year-Month']; this.selectedScalar = 'Month-Week'; @@ -173,6 +180,10 @@ export class NttGanttComponent implements OnInit { { field: 'StartDate', headerText: 'Planned Start-Date', format : {type:'date', format:'dd.MM.yyyy'}} ] } + if(!initial){ + this.refreshData(); + } + } @@ -180,6 +191,8 @@ export class NttGanttComponent implements OnInit { + + /** * The function ngOnInit sets values which are required for rendering the gantt Chart. Furthermore it trims the resources (Changes Array) and sets the paginator to the first page. */