👽 add missing translation support

This commit is contained in:
Baptiste Lemoine 2019-10-01 16:39:29 +02:00
parent 90323c28c7
commit 91101f2326
1 changed files with 18 additions and 1 deletions

View File

@ -27,9 +27,21 @@ import {VotingChoiceComponent} from './pages/voting-choice/voting-choice.compone
import {PasswordComponent} from './pages/password/password.component';
import {HomeComponent} from './pages/home/home.component';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {TranslateLoader, TranslateModule, TranslateService} from '@ngx-translate/core';
import {
MissingTranslationHandler,
MissingTranslationHandlerParams,
TranslateLoader,
TranslateModule,
TranslateService
} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
export class MyMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams) {
return 'some value';
}
}
registerLocaleData(localeFr, 'fr');
export function HttpLoaderFactory(http: HttpClient) {
@ -64,6 +76,11 @@ export function HttpLoaderFactory(http: HttpClient) {
BrowserModule,
AppRoutingModule,
TranslateModule.forRoot({
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler,
},
useDefaultLang: false,
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,