2019-09-18 06:02:21 +00:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
|
|
|
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
|
|
|
2019-09-24 00:03:36 +00:00
|
|
|
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
|
|
|
|
|
|
|
|
export async function createTranslateLoader(nativeService: NativeService) {
|
|
|
|
// tslint:disable-next-line: variable-name
|
2019-11-11 09:09:47 +00:00
|
|
|
const translateLoader = nativeService.getTranslateLoader(
|
|
|
|
'./assets/i18n/',
|
|
|
|
'.json'
|
2019-09-24 00:03:36 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// return new TranslateBrowserLoader(nativeService, './assets/i18n/', '.json');
|
2019-11-11 09:09:47 +00:00
|
|
|
return translateLoader;
|
2019-09-24 00:03:36 +00:00
|
|
|
}
|
|
|
|
|
2019-09-18 06:02:21 +00:00
|
|
|
@NgModule({
|
2019-09-24 00:03:36 +00:00
|
|
|
imports: [
|
|
|
|
TranslateModule.forRoot({
|
|
|
|
loader: {
|
|
|
|
provide: TranslateLoader,
|
|
|
|
useFactory: createTranslateLoader,
|
|
|
|
deps: [UCAP_NATIVE_SERVICE]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2019-09-18 06:02:21 +00:00
|
|
|
exports: []
|
|
|
|
})
|
|
|
|
export class AppTranslateModule {}
|