219 lines
9.7 KiB
TypeScript
219 lines
9.7 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
|
|
/**
|
|
* The LanguageService manages the language (DE or EN) over all Components
|
|
* and returns and returns all textual attributes in the selected language
|
|
* By holding 2 languageMaps for german and english and one languageMap that can be set to the german or english map
|
|
*/
|
|
export class LanguageService {
|
|
|
|
public language: string = 'DE';
|
|
public languages: string[] = ['DE', 'EN'];
|
|
public deMap : Map<string, string> = new Map<string, string>();
|
|
public enMap : Map<string, string> = new Map<string, string>();
|
|
public lMap : Map<string, string> = new Map<string, string>();
|
|
public deColumns: any[];
|
|
public enColumns: any[];
|
|
public dePlanTimeColumns: any[];
|
|
public enPlanTimeColumns: any[];
|
|
public dePlanTimeResources: any[];
|
|
public enPlanTimeResources: any[];
|
|
|
|
/**
|
|
* The constructor sets all the language values and does the default mapping
|
|
*/
|
|
constructor() {
|
|
this.deMap.set('detailButton', 'Details anzeigen');
|
|
this.enMap.set('detailButton', 'Show Details');
|
|
this.deMap.set('filterButton', 'Filter anwenden');
|
|
this.enMap.set('filterButton', 'Apply Filters');
|
|
this.deMap.set('sortButton', 'Sortierung anwenden');
|
|
this.enMap.set('sortButton', 'Apply Sort');
|
|
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.deMap.set('language', 'Sprache');
|
|
this.enMap.set('language', 'Language');
|
|
this.deMap.set('clearFilter', 'Filter Löschen');
|
|
this.enMap.set('clearFilter', 'Clear Filter');
|
|
|
|
this.deMap.set('tooltipSummary', 'Name');
|
|
this.enMap.set('tooltipSummary', 'Name');
|
|
this.deMap.set('tooltipState', 'Status');
|
|
this.enMap.set('tooltipState', 'State');
|
|
this.deMap.set('tooltipPaketType', 'Paket Typ');
|
|
this.enMap.set('tooltipPaketType', 'Package Type');
|
|
this.deMap.set('tooltipContract', 'Vertrag / Provider Cluster');
|
|
this.enMap.set('tooltipContract', 'Contract / Provider Cluster');
|
|
this.deMap.set('tooltipSupportGroupKv', 'KV SG');
|
|
this.enMap.set('tooltipSupportGroupKv', 'KV SG');
|
|
this.deMap.set('tooltipSupportGroupIh', 'IH SG');
|
|
this.enMap.set('tooltipSupportGroupIh', 'IH SG');
|
|
this.deMap.set('tooltipDate', 'Geplantes Start Datum');
|
|
this.enMap.set('tooltipDate', 'Planned Start Date');
|
|
|
|
this.deMap.set('permit', 'Zur Genehmigung');
|
|
this.enMap.set('permit', 'Permit');
|
|
this.deMap.set('genehmigen', 'Genehmigen');
|
|
this.enMap.set('genehmigen', 'Approve');
|
|
this.deMap.set('ablehnen', 'Ablehnen');
|
|
this.enMap.set('ablehnen', 'Reject');
|
|
this.deMap.set('stornieren', 'Stornieren');
|
|
this.enMap.set('stornieren', 'Cancel');
|
|
this.deMap.set('implementer', 'Implementer Eintragen');
|
|
this.enMap.set('implementer', 'Enter Implementer');
|
|
this.deMap.set('stateChange', 'Statusübergang');
|
|
this.enMap.set('stateChange', 'State Transition');
|
|
|
|
this.deMap.set('stateDialogSnackBarMessageFailiure', 'Statusübergang fehlgeschlagen');
|
|
this.enMap.set('stateDialogSnackBarMessageFailiure', 'State Transition failed');
|
|
this.deMap.set('stateDialogSnackBarActionFailiure', 'Schließen');
|
|
this.enMap.set('stateDialogSnackBarActionFailiure', 'close');
|
|
|
|
this.deMap.set('stateDialogSnackBarMsg1Success', 'Statusübergang');
|
|
this.enMap.set('stateDialogSnackBarMsg1Success', 'State Transition');
|
|
|
|
this.deMap.set('stateDialogSnackBarMsg2Success', 'erfolgreich');
|
|
this.enMap.set('stateDialogSnackBarMsgsSuccess', 'successful');
|
|
|
|
this.deMap.set('stateDialogSnackBarActionSuccess', 'Schließen');
|
|
this.enMap.set('stateDialogSnackBarActionSuccess', 'close');
|
|
|
|
this.deMap.set('stateDialogStateTransition', 'Statusübergang');
|
|
this.enMap.set('stateDialogStateTransition', 'State Transition');
|
|
|
|
this.deMap.set('stateDialogSelectState', 'Status auswählen');
|
|
this.enMap.set('stateDialogSelectState', 'Select State');
|
|
|
|
this.deMap.set('stateDialogCancel', 'Abbrechen');
|
|
this.enMap.set('stateDialogCancel', 'Cancel');
|
|
|
|
this.deMap.set('stateDialogConfirm', 'Bestätigen');
|
|
this.enMap.set('stateDialogConfirm', 'Confirm');
|
|
|
|
this.deMap.set('filterDialogShortDesc', 'Kurzbeschreibung* (Eingabe eines Textteiles filtert alle passenden Pakete)');
|
|
this.deMap.set('filterDilogSg', 'Gewählte Supportgruppe in der Rolle Planender IH oder Kostenverantwortlicher (eine)');
|
|
this.deMap.set('filterDilogState', 'Status (einer oder mehrere) des Pakets');
|
|
this.deMap.set('filterDilogContract', 'Vertrag / Provider-Cluster (einen oder mehrere)');
|
|
this.deMap.set('filterDilogPaketType', 'Paket-Typ (einen oder mehrere, exakte Eingabe)');
|
|
this.deMap.set('filterDilogDate', 'Geplantes Start-Datum: Von / Bis');
|
|
|
|
this.deMap.set('filterDilogSearchText', 'Text durchsuchen');
|
|
this.deMap.set('filterDialogSearchSg', 'Supportgruppe suchen & auswählen');
|
|
this.deMap.set('filterDilogSearchState', 'Status suchen & auswählen');
|
|
this.deMap.set('filterDilogSearchContract', 'Vertrag suchen & auswählen');
|
|
this.deMap.set('filterDilogSearchPt', 'Paket-Typ suchen & auswählen');
|
|
this.deMap.set('filterDilogSearchFrom', 'Von');
|
|
this.deMap.set('filterDilogSearchTo', 'Bis');
|
|
|
|
this.enMap.set('filterDialogShortDesc', 'Short description* (entering a text part filters all matching packages)');
|
|
this.enMap.set('filterDilogSg', 'Selected support group in the role of planning IH or cost manager (one)');
|
|
this.enMap.set('filterDilogState', 'State (one or more) of the package');
|
|
this.enMap.set('filterDilogContract', 'Contract / Provider cluster (one or more)');
|
|
this.enMap.set('filterDilogPaketType', 'Package type (one or more, exact input)');
|
|
this.enMap.set('filterDilogDate', 'Planned start date: From / To');
|
|
|
|
this.enMap.set('filterDilogSearchText', 'Text search');
|
|
this.enMap.set('filterDialogSearchSg', 'Search & select support group');
|
|
this.enMap.set('filterDilogSearchState', 'Search & select state');
|
|
this.enMap.set('filterDilogSearchContract', 'Search & select contract');
|
|
this.enMap.set('filterDilogSearchPt', 'Search & select package type');
|
|
this.enMap.set('filterDilogSearchFrom', 'From');
|
|
this.enMap.set('filterDilogSearchTo', 'Until');
|
|
|
|
this.enMap.set('filterDilogButton', 'Apply Filters');
|
|
this.deMap.set('filterDilogButton', 'Filter anwenden');
|
|
this.deMap.set('filterDialogCancel', 'Abbrechen');
|
|
this.enMap.set('filterDialogCancel', 'Cancel');
|
|
|
|
|
|
|
|
this.deMap.set('implementerDialogHeading', 'Implementer Eintragen');
|
|
this.enMap.set('implementerDialogHeading', 'Enter Implementer');
|
|
|
|
this.deMap.set('implementerDialogLabel', 'Implementer auswählen');
|
|
this.enMap.set('implementerDialogLabel', 'Select Implementer');
|
|
|
|
this.deMap.set('implementerDialogCancel', 'Abbrechen');
|
|
this.enMap.set('implementerDialogCancel', 'Cancel');
|
|
|
|
this.deMap.set('implementerDialogApply', 'Bestätigen');
|
|
this.enMap.set('implementerDialogApply', 'Confirm');
|
|
|
|
this.deMap.set('planTimesHeading', 'Planzeit pro Woche');
|
|
this.enMap.set('planTimesHeading', 'Plantimes per Week');
|
|
|
|
this.deMap.set('planTimesResource', 'Planzeit Summen pro Woche');
|
|
this.enMap.set('planTimesResource', 'Plantime Sum per Week');
|
|
|
|
this.deMap.set('planTimesPlantime', 'Planzeit');
|
|
this.enMap.set('planTimesPlantime', 'Plantime');
|
|
this.deMap.set('planTimesStartDate', 'Start Datum');
|
|
this.enMap.set('planTimesStartDate', 'Start Date');
|
|
|
|
this.dePlanTimeResources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
|
this.dePlanTimeColumns = [{ field: 'TaskName', headerText: 'Planzeiten pro Woche', width: 250 }];
|
|
|
|
this.enPlanTimeResources = [{resourceId: 1, resourceName: 'Plantime Sum per Week'}];
|
|
this.enPlanTimeColumns = [{ field: 'TaskName', headerText: 'Planzeit pro Woche', width: 250 }];
|
|
|
|
this.deColumns = [
|
|
{ field: 'TaskName', headerText: 'Kurzbeschreibung', width: 250 },
|
|
{ field: 'stateName', headerText: 'Status', width: 250},
|
|
{ field: 'vertragName', headerText: 'Vertrag / Provider Cluster', width: 150 },
|
|
{ field: 'supportGroup', headerText: 'Gewählte Support Gruppe' },
|
|
{ field: 'StartDate', headerText: 'Geplantes Start-Datum', format : {type:'date', format:'dd.MM.yyyy'}},
|
|
{ field: 'plantime', headerText: 'Planzeit in H', width: 100 },
|
|
];
|
|
this.enColumns = [
|
|
{ field: 'TaskName', headerText: 'Summary', width: 250 },
|
|
{ field: 'stateName', headerText: 'State', width: 250},
|
|
{ field: 'vertragName', headerText: 'Contract / Provider Cluster', width: 150 },
|
|
{ field: 'supportGroup', headerText: 'Selected Support Group' },
|
|
{ field: 'StartDate', headerText: 'Planned Start-Date', format : {type:'date', format:'dd.MM.yyyy'}},
|
|
{ field: 'plantime', headerText: 'Plantime in h', width: 100 },
|
|
];
|
|
|
|
if(navigator.language == 'de-DE'){
|
|
this.language = 'DE';
|
|
this.lMap = this.deMap;
|
|
}else{
|
|
this.language = 'EN';
|
|
this.lMap = this.enMap;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The function languageChange set the language map to the german or english map depending on the selected language
|
|
* it is triggered by an language change from the NttGanttComponent
|
|
* @param args args with the selected language
|
|
*/
|
|
public languageChange(args: any){
|
|
if(this.language == 'DE'){
|
|
this.lMap = this.deMap;
|
|
}else{
|
|
this.language = 'EN';
|
|
this.lMap = this.enMap;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The function getColumns delivers the gannt chart columns for the NttGanttComponent in the selected language
|
|
* it is triggered by an language change from the NttGanttComponent
|
|
*/
|
|
public getColumns(){
|
|
if(this.language == 'DE'){
|
|
return this.deColumns;
|
|
}else{
|
|
this.language = 'EN';
|
|
return this.enColumns;
|
|
}
|
|
}
|
|
}
|
|
|