import { NgxTethysModule , ThyTranslate } from 'ngx-tethys' ; import { Observable } from 'rxjs/internal/Observable' ; import { CommonModule } from '@angular/common' ; import { NgModule } from '@angular/core' ; import { FormsModule } from '@angular/forms' ; import { TranslateModule , TranslateService } from '@ngx-translate/core' ; import { ThyEmptyBasicExampleComponent } from './basic/basic.component' ; import { ThyEmptyContainerExampleComponent } from './container/container.component' ; import { ThyEmptyCustomizeExampleComponent } from './customize/customize.component' ; import { ThyEmptyEntityNameExampleComponent } from './entity-name/entity-name.component' ; import { ThyEmptyIconExampleComponent } from './icon/icon.component' ; import { ThyEmptyImgExampleComponent } from './img/img.component' ; import { ThyEmptyMarginTopExampleComponent } from './margin-top/margin-top.component' ; import { ThyEmptyMessageExampleComponent } from './message/message.component' ; import { ThyEmptySizeExampleComponent } from './size/size.component' ; import { ThyEmptyTopExampleComponent } from './top/top.component' ; import { ThyEmptyTranslationKeyExampleComponent } from './translation-key/translation-key.component' ; const COMPONENTS = [ ThyEmptyBasicExampleComponent , ThyEmptySizeExampleComponent , ThyEmptyTopExampleComponent , ThyEmptyMessageExampleComponent , ThyEmptyEntityNameExampleComponent , ThyEmptyIconExampleComponent , ThyEmptyImgExampleComponent , ThyEmptyCustomizeExampleComponent , ThyEmptyContainerExampleComponent , ThyEmptyMarginTopExampleComponent , ThyEmptyTranslationKeyExampleComponent ] ; @ NgModule ( { declarations : [ ... COMPONENTS ] , entryComponents : [ ... COMPONENTS ] , imports : [ CommonModule , FormsModule , TranslateModule . forRoot ( ) , TranslateModule , NgxTethysModule ] , exports : [ ... COMPONENTS ] , providers : [ { provide : ThyTranslate , useFactory : ( translate ) => { return { instant ( key , interpolateParams ? ) { return translate . instant ( key , interpolateParams ) ; } , get ( key , interpolateParams ? ) { return translate . get ( key , interpolateParams ) ; } } ; } , deps : [ TranslateService ] } ] } ) export class ThyEmptyExamplesModule { constructor ( private translate ) { translate . use ( 'zh-cn' ) ; translate . setTranslation ( 'zh-cn' , { common : { tips : { NO_RESULT : '没有数据' , NO_RESULT_TARGET : '没有{{target}}' } } , mission : { PROJECT : '项目' , TASK : '任务' } } ) ; } }