Internationnalisation de la page de login
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { BrowserModule } from "@angular/platform-browser";
|
||||
import { APP_INITIALIZER, NgModule } from "@angular/core";
|
||||
import { RouterModule, Routes } from "@angular/router";
|
||||
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
|
||||
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
||||
import { AppComponent } from "./app.component";
|
||||
import { environment } from "../environments/environment";
|
||||
@@ -59,8 +61,6 @@ import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
|
||||
import { CachingInterceptor } from "../interceptor/caching.interceptor";
|
||||
//import { BasicAuthInterceptor } from '../interceptor/basic-auth.interceptor';
|
||||
import { JwtAuthInterceptor } from "../interceptor/jwt-auth.interceptor";
|
||||
import { ErrorInterceptor } from "../interceptor/error.interceptor";
|
||||
import { UserProfileComponent } from "./user-profile/user-profile.component";
|
||||
@@ -112,6 +112,11 @@ const appRoutes: Routes = [
|
||||
{ path: "login", component: LoginComponent },
|
||||
];
|
||||
|
||||
// AOT compilation support
|
||||
export function httpTranslateLoader(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http);
|
||||
}
|
||||
|
||||
// Déclaration de la fonction d'initialisation de la configuration
|
||||
export function initConfig(configService: ConfigurationHelper) {
|
||||
return () => configService.load(environment.env);
|
||||
@@ -144,6 +149,13 @@ export function initConfig(configService: ConfigurationHelper) {
|
||||
appRoutes,
|
||||
{ enableTracing: !environment.production, relativeLinkResolution: 'legacy' } // <-- debugging purposes only
|
||||
),
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useFactory: httpTranslateLoader,
|
||||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
BrowserModule,
|
||||
@@ -187,7 +199,6 @@ export function initConfig(configService: ConfigurationHelper) {
|
||||
{ provide: APP_INITIALIZER, useFactory: initConfig, deps: [ConfigurationHelper], multi: true },
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: JwtAuthInterceptor, multi: true },
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }
|
||||
// { provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true }
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user