import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  title = 'Tools';
  height!: number;
  width!: number;

  constructor(public translate: TranslateService) {
    this.initTranslation();
  }
  ngAfterViewInit() {
    this.height = window.innerHeight;
    this.width = window.innerWidth;
  }

  private initTranslation(): void {
    this.translate.addLangs(['en', 'de']);
    const userLang = localStorage.getItem('language');
    this.translate.setDefaultLang(userLang || 'de');
  }
}
