Skip to content
Snippets Groups Projects
app.component.ts 843 B
Newer Older
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
Diego Rey's avatar
Diego Rey committed
import { TranslateService } from '../../node_modules/@ngx-translate/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
Diego Rey's avatar
Diego Rey committed
    constructor(public router: Router, public translate: TranslateService) {
        this.translate.addLangs(['es', 'en']);
        let currentSession = sessionStorage.getItem("currentUser"); 
        let language = currentSession ? JSON.parse(currentSession).language : 'es';
        if (language) {
            this.translate.setDefaultLang(language);
        } else {
            this.translate.setDefaultLang('es');
        }
Diego Rey's avatar
Diego Rey committed
    }
    ngOnInit() {
        //this.router.navigate(['/login']);
    }
}