Use po files with ngx-translate
Clone or download
Latest commit 7d39be1 Aug 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src upgrade to angualr 6 May 16, 2018
.gitignore Update ng2-translate to ngx-translate/core + pinned packages Mar 7, 2017
README.md Fix README.md Nov 7, 2017
package-lock.json upgrade to angualr 6 May 16, 2018
package.json upgrade to angualr 6 May 16, 2018
tsconfig.json Move to gettext-parser package Dec 12, 2016
tslint.json Move to gettext-parser package Dec 12, 2016

README.md

Description

Load po files for use with ngx-translate

Installation:

npm i @ngx-translate/core --save
npm i @biesbjerg/ngx-translate-po-http-loader --save

Usage:

import { HttpClient, HttpClientModule } from '@angular/common/http';

import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslatePoHttpLoader } from '@biesbjerg/ngx-translate-po-http-loader';

export function createTranslateLoader(http: HttpClient) {
	return new TranslatePoHttpLoader(http, 'assets/i18n', '.po');
}

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