I am using ng2-translate
node package to implement translations in an Angular SPA application.
Following the instruction found at https://www.npmjs.com/package/ng2-translate (see Section #3 Define Translations), I defined the translations in one of the components as follows:
import { Component, } from '@angular/core';
import { TranslateService } from 'ng2-translate';
@Component({
selector: 'home',
templateUrl: './home.component.html'
})
export class HomeComponent {
constructor(private translate: TranslateService) {
this.translate.setTranslation('en', {
"HELLO": "Hello World from TranslateServiceLand"
}, true);
this.translate.setTranslation('fr', {
"HELLO": "Bonjour tout le moonde d'TranslateServiceLand"
}, true);
}
}
This is however not working. Can someone please provide me with an example?