Hi all,
I want to translate the validation messages.
One of the options to do this is to use the i18n property:
In my template:
<jsonforms #jsonForm
[data]="_data"
[schema]="_schema"
[uischema]="_uiSchema"
[renderers]="renderers"
[ajv]="ajv"
[i18n]="i18nObj"
(dataChange)="formChange($event)"
(errors)="onErrors($event)"></jsonforms>
In my code:
i18nObj = {
translate:
(key: string, defaultMessage: string | undefined) => {
return this.myTranslationService.translate(key, defaultMessage);
}
}
But when I do this, I notice that every time the user enters a character in a text field on the form, the translation service is called for ALL the elements on the form that need translation. In my case it is performing about 100 translation lookups every time the user enters a character (and every time the same lookups).
Why is it doing this? I would expect that the translation function is only called one time for each element.