I'm trying to integrate i18n to my angular7 application. It uses kendo-ui too.
Kendo-ui templates contains English expressions, but my app code contains Hungarian expressions.
If I generate the messages.xlf
file with the ng xi18n --output-path translate
, the generated file will contain the English expressions from kendo-ui and the Hungarian expressions from my app.
What could be the proper way to generate the messages.xlf
?
I was wrong because not necessary to use angular i18n for Kenod-UI translations.
The MessageService
was perfect for me: https://www.telerik.com/kendo-angular-ui/components/globalization/localization/messages/#toc-using-the-message-service
So I kept the original ngx-translate solution in my app code and I've added a new provider (the implementation of MessageService) which resolves the translations from Kendo-UI.
This is the code of my MessagesService:
export class KendoMessageService extends MessageService {
constructor(private translateService: TranslateService) {}
public get(key: string): string {
const resolvedValue = this.translateService.instant(key);
return resolvedValue !== key ? resolvedValue : void 0;
}
}