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

82 lines
3.1 KiB
TypeScript
Raw Normal View History

2020-06-12 19:17:39 +02:00
import { CommonModule, registerLocaleData } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
2020-05-12 19:16:23 +02:00
import localeEn from '@angular/common/locales/en';
import localeFr from '@angular/common/locales/fr';
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 { ShortcutsHelpComponent } from './features/shared/components/ui/shortcuts-help/shortcuts-help.component';
2020-05-12 19:16:23 +02:00
registerLocaleData(localeEn, 'en-EN');
registerLocaleData(localeFr, 'fr-FR');
2019-08-12 14:40:33 +02: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 {
2020-04-21 10:50:26 +02:00
return new TranslateHttpLoader(http);
2019-10-01 15:43:37 +02:00
}
@NgModule({
2021-02-08 11:32:58 +01:00
declarations: [AppComponent, CguComponent, LegalComponent, PrivacyComponent, CipheringComponent],
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({
defaultLanguage: 'FR',
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],
2021-05-04 09:33:28 +02:00
exports: [ErrorsListComponent],
})
export class AppModule {}