From 28d5b356e4184ac830d0c975f89419e1ad66657d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neftal=C3=AD=20Yagua?= Date: Tue, 28 Jan 2025 14:17:32 -0500 Subject: [PATCH] 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. --- src/app/app.module.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d9734a9f9..b2bf3cef3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 ] }