Hi All,
I’m trying to override the default error messages using the i18n object. However, when trying to bind to my i18n object i get the error: Can’t bind to ‘i18n’ since it isn’t a known property of ‘jsonforms’ Here is my json forms root component:
<jsonforms
#form
[schema]="schema"
[renderers]="renderers"
[ajv] ="ajv"
[locale]="'en-US'"
[(data)]="formData"
[validationMode] ="validationMode"
(dataChange)="onChange($event)"
(errors)="onErrors($event)"
[i18n] = "i18nObj" >
</jsonforms>
Here is my i18nObj that I’m trying to bind to the i18n prop:
i18nObj = {
translate:
(key: string, defaultMessage: string | undefined) => {
if(key === "error.required"){
return "This field is required."
}
return defaultMessage;
}
}
I see in the documentation that the i18n has the @Input decorator:
export class JsonForms implements OnChanges, OnInit {
@Input() uischema: UISchemaElement;
@Input() schema: JsonSchema;
@Input() data: any;
@Input() renderers: JsonFormsRendererRegistryEntry[];
@Input() uischemas: { tester: UISchemaTester; uischema: UISchemaElement; }[];
@Output() dataChange = new EventEmitter<any>();
@Input() readonly: boolean;
@Input() validationMode: ValidationMode;
@Input() ajv: Ajv;
@Input() config: any;
@Input() i18n: JsonFormsI18nState;
@Input() additionalErrors: ErrorObject[];
@Output() errors = new EventEmitter<ErrorObject[]>();
Here is my package.json:
“@jsonforms/angular”: “3.0.0-alpha.1”,
“@jsonforms/angular-material”: “^3.0.0-alpha.1”,
“@jsonforms/core”: “^3.0.0-alpha.1”,
“@jsonforms/material-renderers”: “^3.0.0-alpha.1”,
Any idea what’s happening here? Am i approaching this in the wrong way? Any guidance would be greatly appreciated. Thanks