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

@Injectable({
  providedIn: 'root'
})
export class LanguageService {

  constructor(
    private translate: TranslateService
  ) { }

  getDefaultLanguage() {
    let language = this.translate.getBrowserLang() ?? 'es';
    this.translate.setDefaultLang(language);
    console.log(language);
    return language;
  }

  setLanguage(setLang: string) {
    this.translate.use(setLang);
  }
}
