ngx-translate-properties-loader2
v1.1.3
Published
A http-loader for ngx-translate that supports .properties and .json formats
Downloads
1,345
Readme
@ngx-translate/http-properties-loader
Http loader for properties files in @ngx-translate (i18n) library for Angular 6 or higher.
Installation
Install @ngx-translate/core
and ngx-translate-properties-loader
into your project:
npm i "@ngx-translate/core" ngx-translate-properties-loader2
Usage
1. Create HttpLoaderFactory
:
import { TranslateHttpPropertiesLoader } from 'ngx-translate-properties-loader';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpPropertiesLoader(http, './localization/messages_', '.properties');
}
2. Use HttpLoaderFactory
in your TranslateModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
@NgModule({
imports: [
BrowserModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
],
bootstrap: [AppComponent]
})
export class AppModule { }
Enjoy!