I came up with the following solution, it is probably not the best, but it works. It just searches for the message manually from the en.json file. I tried to use params.translateService.currentLangit params.translateService.getDefaultLang()for implementation, but they were always undefinedfor some reason :(
import { MissingTranslationHandler, MissingTranslationHandlerParams } from 'ng2-translate';
let enBundle = require('../../assets/data/i18n/en.json');
export class MyMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams) {
return enBundle[params.key];
}
}
source
share