next-ucap-messenger/projects/ucap-webmessenger-app/src/app/app-translate.module.ts
2019-12-18 13:44:26 +09:00

34 lines
884 B
TypeScript

import { NgModule } from '@angular/core';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
import { environment } from '../environments/environment';
export function createTranslateLoader(nativeService: NativeService) {
const translateLoader = nativeService.getTranslateLoader(
environment.production
? './assets/i18n/'
: '/projects/ucap-webmessenger-app/src/assets/i18n/',
'.json'
);
// return new TranslateBrowserLoader(nativeService, './assets/i18n/', '.json');
return translateLoader;
}
@NgModule({
imports: [
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [UCAP_NATIVE_SERVICE]
}
})
],
exports: []
})
export class AppTranslateModule {}