@unifiedfactory/ngx-translate-gettext-loader
v0.0.3
Published
ngx-translate translation loader for .po and .mo files
Downloads
52
Readme
Description
Load gettext files for use with ngx-translate
Usage:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { GettextLoader } from '@unifiedfactory/ngx-translate-gettext-loader';
import { AppComponent } from './app';
export function GettextLoaderFactory(httpClient: HttpClient) {
return new GettextLoader(httpClient, 'assets/i18n', '.po');
}
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: GettextHttpLoaderFactory,
deps: [HttpClient]
}
})
],
bootstrap: [AppComponent]
})
export class AppModule { }