Correct path to i18n dictionaries (#2249)

The path to i18n could not be accessed by HttpClient because it is intervened by the general interceptor, in this change we use HttpClient without the interceptor, which allows the files to be loaded directly from the real path as a standard asset.
This commit is contained in:
Neftalí Yagua
2025-01-28 13:17:32 -06:00
committed by GitHub
parent eadc6687b8
commit 28d5b356e4
+5 -8
View File
@@ -2,7 +2,7 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpBackend, HttpClient, HttpClientModule } from '@angular/common/http';
/** Environment Configuration */
@@ -58,15 +58,12 @@ export function HttpLoaderFactory(http: HttpClient) {
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (http: HttpClient, locationStrategy: LocationStrategy) => {
return new TranslateHttpLoader(
http,
`${window.location.protocol}//${window.location.host}${locationStrategy.getBaseHref()}/assets/translations/`,
'.json'
);
useFactory: (httpBackend: HttpBackend, locationStrategy: LocationStrategy) => {
const http = new HttpClient(httpBackend);
return new TranslateHttpLoader(http, `/assets/translations/`, '.json');
},
deps: [
HttpClient,
HttpBackend,
LocationStrategy
]
}