import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core'; import { Translation, TranslocoLoader } from '@ngneat/transloco'; import { Observable } from 'rxjs'; @Injectable({providedIn: 'root'}) export class TranslocoHttpLoader implements TranslocoLoader { private _httpClient = inject(HttpClient); // ----------------------------------------------------------------------------------------------------- // @ Public methods // ----------------------------------------------------------------------------------------------------- /** * Get translation * * @param lang */ getTranslation(lang: string): Observable { return this._httpClient.get(`./assets/i18n/${lang}.json`); } }