change datepicker dialog language
parent
8f2a33fcef
commit
a478738fa9
|
|
@ -22,6 +22,8 @@ import { SavePresetUnderDialogComponent } from '../save-preset-under-dialog/save
|
|||
import { Location } from '@angular/common';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { GanttModule, ResizeService } from '@syncfusion/ej2-angular-gantt';
|
||||
import { DateAdapter } from '@angular/material/core';
|
||||
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
|
||||
|
||||
export const MY_DATE_FORMATS = {
|
||||
|
|
@ -197,7 +199,7 @@ export class NttGanttComponent implements OnInit {
|
|||
* @param dataService injects the dataService for data management and backend communication
|
||||
* @param matDialog injects the matDialog
|
||||
*/
|
||||
constructor(public languageService: LanguageService, public dataService: DataService, public matDialog: MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService, private location: Location) {
|
||||
constructor(public languageService: LanguageService, public dataService: DataService, public matDialog: MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService, private location: Location, private dateAdapter: DateAdapter<Date>) {
|
||||
this.initLanguge(true);
|
||||
}
|
||||
|
||||
|
|
@ -684,9 +686,18 @@ export class NttGanttComponent implements OnInit {
|
|||
*/
|
||||
public languageChange(args: any) {
|
||||
this.languageService.languageChange(args.value),
|
||||
this.initLanguge();
|
||||
this.initLanguge();
|
||||
this.plantimeComponent.changeLanguage();
|
||||
this.editUserPreferences();
|
||||
this.updateDatePickerLocale();
|
||||
}
|
||||
|
||||
private updateDatePickerLocale() {
|
||||
if (this.languageService.language === 'DE') {
|
||||
this.dateAdapter.setLocale('de');
|
||||
} else {
|
||||
this.dateAdapter.setLocale('en');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -699,11 +710,12 @@ export class NttGanttComponent implements OnInit {
|
|||
if (this.languageService.language == 'DE') {
|
||||
this.scalars = ['Monat', 'Jahr'];
|
||||
this.selectedScalar = 'Monat';
|
||||
this.dateAdapter.setLocale('de');
|
||||
}
|
||||
else {
|
||||
this.scalars = ['Month', 'Year'];
|
||||
this.selectedScalar = 'Month';
|
||||
|
||||
this.dateAdapter.setLocale('en');
|
||||
}
|
||||
this.columns = this.languageService.getColumns();
|
||||
if (!initial) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue