Hello There
I want to customize error messages with i18n, but I have no idea how to deal with interpolation. Is something like that {{minLength}}
based on property’s schema value possible?
const translate = (key: string, defaultMessage: string, args: any) => {
const translations = {
error: {
required: 'is required',
minLength: `should have at least {{minLength}} characters`,
},
};
return get(translations, key) ?? defaultMessage;
};
return (
<JsonForms
schema={schema}
uischema={uiSchema}
data={data}
renderers={renderers}
cells={cells}
onChange={handleOnChange}
ajv={ajv}
i18n={{ translate }}
/>
Or is there other way to handle this kind of error messages customization?
Thanks for help in advance