funky-framadate-front/src/app/app.module.ts

87 lines
3.1 KiB
TypeScript
Raw Normal View History

2022-02-03 11:33:57 +01:00
import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
2022-02-03 10:45:09 +01:00
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
2020-04-22 12:56:18 +02:00
import { BrowserModule, Title } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
2020-04-21 10:50:26 +02:00
MissingTranslationHandler,
MissingTranslationHandlerParams,
TranslateLoader,
TranslateModule,
TranslateService,
} from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ClipboardModule } from 'ngx-clipboard';
import { MarkdownModule } from 'ngx-markdown';
2020-04-22 12:56:18 +02:00
import { NgxWebstorageModule } from 'ngx-webstorage';
2019-11-22 10:18:09 +01:00
2020-04-22 12:56:18 +02:00
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
2020-04-22 12:56:18 +02:00
import { CoreModule } from './core/core.module';
import { SharedModule } from './shared/shared.module';
2021-02-04 18:54:30 +01:00
import { CguComponent } from './features/shared/components/ui/static-pages/cgu/cgu.component';
import { LegalComponent } from './features/shared/components/ui/static-pages/legal/legal.component';
import { PrivacyComponent } from './features/shared/components/ui/static-pages/privacy/privacy.component';
2021-02-08 11:32:58 +01:00
import { CipheringComponent } from './features/shared/components/ui/static-pages/ciphering/ciphering.component';
2021-05-04 09:33:28 +02:00
import { ErrorsListComponent } from './features/shared/components/ui/form/errors-list/errors-list.component';
import { KeyboardShortcutsModule } from 'ng-keyboard-shortcuts';
import { AdministrationModule } from './features/administration/administration.module';
import { ChoiceButtonDinumComponent } from './features/shared/components/choice-button-dinum/choice-button-dinum.component';
import { StaticPagesComponent } from './features/shared/static-pages/static-pages.component';
2022-02-03 10:45:09 +01:00
export class MyMissingTranslationHandler implements MissingTranslationHandler {
2020-04-22 12:56:18 +02:00
public handle(params: MissingTranslationHandlerParams): string {
return `MISSING TRANSLATION FOR [${params.key}]`;
2020-04-21 10:50:26 +02:00
}
}
2019-08-12 14:40:33 +02:00
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
2019-10-01 15:43:37 +02:00
}
@NgModule({
declarations: [
AppComponent,
CguComponent,
LegalComponent,
PrivacyComponent,
CipheringComponent,
StaticPagesComponent,
],
2020-04-21 10:50:26 +02:00
imports: [
2020-04-22 12:56:18 +02:00
AppRoutingModule,
AdministrationModule,
2020-04-22 12:56:18 +02:00
BrowserAnimationsModule,
BrowserModule,
2020-04-21 10:50:26 +02:00
ClipboardModule,
CommonModule,
2020-04-22 12:56:18 +02:00
CoreModule,
FormsModule,
HttpClientModule,
KeyboardShortcutsModule.forRoot(),
2020-04-21 10:50:26 +02:00
MarkdownModule.forRoot(),
2020-04-22 12:56:18 +02:00
NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
SharedModule,
2020-04-21 10:50:26 +02:00
TranslateModule.forRoot({
2022-02-03 10:45:09 +01:00
defaultLanguage: environment.defaultLanguage,
2020-04-21 10:50:26 +02:00
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
2020-04-22 12:56:18 +02:00
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler,
},
useDefaultLang: true,
2020-04-21 10:50:26 +02:00
}),
],
2020-06-12 19:17:39 +02:00
providers: [Title, TranslateService],
2020-04-21 10:50:26 +02:00
bootstrap: [AppComponent],
exports: [ErrorsListComponent, ChoiceButtonDinumComponent],
})
export class AppModule {}