@danvick/ngx-translate-nativescript-loader
by danvick | v3.0.1
A loader for ngx-translate that loads locally stored translations for NativeScript.
npm i --save @danvick/ngx-translate-nativescript-loader
  • Version: 3.0.1
  • GitHub:
  • Downloads:
    • Last Day:   0
    • Last Week:  0
    • Last Month: 0

Description

A loader for ngx-translate that loads localally stored translations for NativeScript.

Version Size Downloads

Installation:

npm i @ngx-translate/core --save
npm i @danvick/ngx-translate-nativescript-loader --save

Usage:

import { NgModule } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { NativeScriptLoader } from '@danvick/ngx-translate-nativescript-loader';

export function createTranslateLoader() {
return new NativeScriptLoader("./assets/i18n/", ".json");
}

@NgModule({
imports: [
NativeScriptModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader
}
})
],
bootstrap: [AppComponent]
})
export class AppModule { }

The assumed default location for your translation is ./assets/i18n/ and default assumed format extesion is .json. So you could ignore the arguments all together and have your createTranslateLoader() function as:

export function createTranslateLoader() {
return new NativeScriptLoader();
}