@ngx-translate/core#TranslateModule TypeScript Examples

The following examples show how to use @ngx-translate/core#TranslateModule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: test.utils.ts    From WowUp with GNU General Public License v3.0 7 votes vote down vote up
export function createTranslateModule(): ModuleWithProviders<TranslateModule> {
  return TranslateModule.forRoot({
    loader: {
      provide: TranslateLoader,
      useFactory: testHttpLoaderFactory,
      deps: [HttpClient],
    },
    compiler: {
      provide: TranslateCompiler,
      useClass: TranslateMessageFormatCompiler,
    },
  });
}
Example #2
Source File: translation.module.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
static forRoot(): ModuleWithProviders<TranslateModule> {
    return TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient],
      }
    });
  }
Example #3
Source File: errors.module.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
@NgModule({
  declarations: [
    UndefinedErrorComponent,
    NotSupportedNetworkErrorComponent,
    InsufficientFundsErrorComponent,
    MetamaskErrorComponent,
    NetworkErrorComponent,
    TotalSupplyOverflowErrorComponent,
    OverQueryLimitErrorComponent,
    MaxGasPriceOverflowErrorComponent,
    UnknownErrorComponent,
    InsufficientFundsCcrErrorComponent,
    InsufficientFundsOneinchErrorComponent,
    TokenWithFeeErrorComponent,
    UnsupportedTokenCCRComponent,
    RpcErrorComponent
  ],
  imports: [CommonModule, SharedModule, TranslateModule, InlineSVGModule, TuiManualHintModule],
  entryComponents: [
    UndefinedErrorComponent,
    NotSupportedNetworkErrorComponent,
    InsufficientFundsErrorComponent,
    MetamaskErrorComponent,
    NetworkErrorComponent,
    TotalSupplyOverflowErrorComponent,
    OverQueryLimitErrorComponent,
    UnknownErrorComponent,
    InsufficientFundsCcrErrorComponent
  ]
})
export class ErrorsModule {}
Example #4
Source File: app.module.ts    From ng-devui-admin with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    AppRoutingModule,
    CoreModule.forRoot(),
    SharedModule.forRoot(),
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useClass: I18NLoader,
      },
    }),
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}
Example #5
Source File: common-share.module.ts    From dbm with Apache License 2.0 6 votes vote down vote up
@NgModule({
  imports: [
    NgZorroAntdModule,
    TranslateModule,
    CodemirrorModule,
    FormsModule,
    CommonModule,
    ServiceModule,
    ChartModule,
    TableModule,
    MomentModule,
    ReactiveFormsModule,
    EllipsisModule
  ],
  declarations: [
    DdlQueryComponent,
    BasicTableComponent,
    LineChartsComponent,
    EmptyAntdComponent,
    DrividerAntdComponent,
    CreateSnippetComponent
  ],
  providers: [
    ClipboardComService
  ],
  exports: [
    DdlQueryComponent,
    BasicTableComponent,
    LineChartsComponent,
    EmptyAntdComponent,
    DrividerAntdComponent,
    CreateSnippetComponent
  ]
})
export class CommonShareModule {
}
Example #6
Source File: app.module.ts    From mylog14 with GNU General Public License v3.0 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (LanguageLoader),
        deps: [HttpClient],
      }
    }),
    CoreModule,
    SharedModule,
    LottieModule.forRoot({ player: playerFactory }),
    ReactiveFormsModule,
    FormlyModule.forRoot(),
    FormlyIonicModule
  ],
  providers: [
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #7
Source File: app.component.spec.ts    From msfs-community-downloader with GNU Affero General Public License v3.0 6 votes vote down vote up
describe('AppComponent', () => {
    beforeEach(waitForAsync(() => {
        TestBed.configureTestingModule({
            declarations: [AppComponent],
            providers: [ElectronService],
            imports: [RouterTestingModule, TranslateModule.forRoot()]
        }).compileComponents();
    }));

    it('should create the app', waitForAsync(() => {
        const fixture = TestBed.createComponent(AppComponent);
        const app = fixture.debugElement.componentInstance;
        expect(app).toBeTruthy();
    }));
});
Example #8
Source File: app.module.ts    From ionic-doctor-online with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    MyApp
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    }),
    SuperTabsModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ShareServiceProvider,
    Storage
  ]
})
export class AppModule {}
Example #9
Source File: app.component.spec.ts    From VIR with MIT License 6 votes vote down vote up
describe('AppComponent', () => {
  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      declarations: [AppComponent],
      providers: [ElectronService],
      imports: [RouterTestingModule, TranslateModule.forRoot()]
    }).compileComponents();
  }));

  it('should create the app', waitForAsync(() => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));
});
Example #10
Source File: alert-dialog.component.spec.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
describe("AlertDialogComponent", () => {
  let linkService: any;

  beforeEach(async () => {
    linkService = jasmine.createSpyObj("LinkService", [""], {});

    await TestBed.configureTestingModule({
      declarations: [AlertDialogComponent],
      imports: [
        MatModule,
        NoopAnimationsModule,
        HttpClientModule,
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useFactory: httpLoaderFactory,
            deps: [HttpClient],
          },
          compiler: {
            provide: TranslateCompiler,
            useClass: TranslateMessageFormatCompiler,
          },
        }),
      ],
      providers: [
        { provide: MAT_DIALOG_DATA, useValue: {} },
        { provide: MatDialogRef, useValue: {} },
        { provide: LinkService, useValue: linkService },
      ],
    }).compileComponents();
  });

  it("should create", () => {
    const fixture = TestBed.createComponent(AlertDialogComponent);
    expect(fixture.componentInstance).toBeTruthy();
  });
});
Example #11
Source File: app.module.ts    From t3mpl-editor with MIT License 6 votes vote down vote up
@NgModule({
	declarations: [
		AppComponent
	],
	imports: [
		BrowserModule,
		EditorModule,
		HttpClientModule,
		TranslateModule.forRoot({
			loader: {
				provide: TranslateLoader,
				useFactory: HttpLoaderFactory,
				deps: [HttpClient]
			},
			defaultLanguage: 'en'
		})
	],
	providers: [],
	bootstrap: [AppComponent]
})
export class AppModule {
}
Example #12
Source File: components.module.ts    From Elastos.Essentials.App with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
  ],
  imports: [
    CommonModule,
    IonicModule,
    TranslateModule
  ],
  exports: [],
  providers: [
  ],
  entryComponents: [],
})
export class ComponentsModule { }