Skip to content

UnifiedFactory/ngx-translate-gettext-loader

Repository files navigation

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 { }

About

ngx-translate translation loader for .po and .mo files

Resources

License

Stars

Watchers

Forks

Packages

No packages published