mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-10 10:31:37 +00:00
25 lines
808 B
TypeScript
25 lines
808 B
TypeScript
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<Translation>
|
|
{
|
|
return this._httpClient.get<Translation>(`./assets/i18n/${lang}.json`);
|
|
}
|
|
}
|