import { HttpClient } from '@angular/common/http' ; import { Inject , ModuleWithProviders , NgModule , Optional , SkipSelf } from '@angular/core' ; import { TranslateModule } from '@ngx-translate/core' ; import { TranslateHttpLoader } from '@ngx-translate/http-loader' ; import { I18NService } from './i18n.service' ; import { T7E_PREFIX } from './tokens' ; export const translateFactory = ( http , prefix ) => new TranslateHttpLoader ( http , prefix ) ; @ NgModule ( { imports : [ TranslateModule . forRoot ( ) ] , providers : [ I18NService ] , exports : [ TranslateModule ] } ) export class I18NModule { static forRoot ( configuredProviders ? ) { return { ngModule : I18NModule , providers : configuredProviders } ; } constructor ( @ Optional ( ) @ SkipSelf ( ) parentModule ? , @ Inject ( T7E_PREFIX ) @ Optional ( ) readonly t7ePrefix ? ) { if ( parentModule ) { throw new Error ( 'I18NModule already loaded. Import in root module only.' ) ; } } }