From 8b0509e0aeb45241f45c1e9dee884241b516f1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Barbeau?= Date: Wed, 12 Apr 2017 14:32:17 -0400 Subject: [PATCH] fix(translate): add translate providers in lib --- lib/src/module.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/src/module.ts b/lib/src/module.ts index 88b9a60764..7eb8695de6 100644 --- a/lib/src/module.ts +++ b/lib/src/module.ts @@ -1,5 +1,8 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; +import { Http } from '@angular/http'; import { MaterialModule } from '@angular/material'; +import { TranslateModule, TranslateLoader, + TranslateStaticLoader } from 'ng2-translate'; import 'rxjs/add/operator/debounceTime.js'; import 'rxjs/add/operator/distinctUntilChanged'; @@ -22,6 +25,10 @@ import { IgoQueryModule } from './query/index'; import { IgoSearchModule } from './search/index'; import { IgoSharedModule } from './shared/index'; +export function createTranslateLoader(http: Http) { + return new TranslateStaticLoader(http, './locale', '.json'); +} + const IGO_MODULES = [ IgoLanguageModule, IgoFeatureModule, @@ -37,6 +44,11 @@ const IGO_MODULES = [ @NgModule({ imports: [ MaterialModule.forRoot(), + TranslateModule.forRoot({ + provide: TranslateLoader, + useFactory: createTranslateLoader, + deps: [Http] + }), IgoCoreModule.forRoot(), IgoLanguageModule.forRoot(),