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

@Injectable({
  providedIn: 'root',
})
export class TranslationService {
    language: string = 'fr'; // Par défaut, français

    constructor(private translate: TranslateService) {}
  
    onLanguageChange(event: any) {
      this.language = event.target.value;
      this.translate.use(this.language);
      console.log(this.language);
    }
  
    getFlagImageUrl(): string {
      return `../../assets/img/${this.language}_flag.jpg`;
    }
}