28 lines
956 B
TypeScript
28 lines
956 B
TypeScript
import { TranslateLoader } from '@ngx-translate/core';
|
|
import { Observable } from 'rxjs';
|
|
import { environment } from 'environments/environment';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { ConfigurationService } from '../configuration/configuration.service';
|
|
import { BaseHttpParams } from '@common/http/base-http-params';
|
|
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
|
|
|
export class TranslateServerLoader implements TranslateLoader{
|
|
private get apiBase(): string { return `${this.configurationService.server}language`; }
|
|
|
|
constructor(
|
|
private http: HttpClient,
|
|
private configurationService: ConfigurationService
|
|
) {
|
|
|
|
}
|
|
getTranslation(lang: string): Observable<any> {
|
|
const params = new BaseHttpParams();
|
|
// params.interceptorContext = {
|
|
// excludedInterceptors: [
|
|
// InterceptorType.AuthToken,
|
|
// ]
|
|
// };
|
|
return this.http.get(`${this.apiBase}/${lang}`, { params: params });
|
|
}
|
|
}
|