framadate-responsive/src/app/app.module.ts

71 lines
2.2 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';
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({
2020-05-01 19:10:17 +02:00
declarations: [AppComponent],
2020-04-21 10:50:26 +02:00
imports: [
2020-04-22 12:56:18 +02:00
AppRoutingModule,
BrowserAnimationsModule,
BrowserModule,
2020-04-21 10:50:26 +02:00
ClipboardModule,
CommonModule,
2020-04-22 12:56:18 +02:00
CoreModule,
FormsModule,
HttpClientModule,
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({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
2020-04-22 12:56:18 +02:00
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler,
},
useDefaultLang: false,
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],
})
export class AppModule {}