MessageProviderProps interface
Signature:
export interface MessageProviderProps
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| children | ReactNode | ||
| context? | MessageContext | (Optional) | |
| debug? | ‘error’ | ‘warn’ | ((msg: string) => unknown) | (Optional) | |
| locale? | string | (Optional) A key for the locale of the given messages. If uset, will inherit the locale from the parent context, or ultimately use en empty string. | |
| merge? | MessageContext[‘merge’] | (Optional) By default, top-level namespaces defined in a child MessageProvider overwrite those defined in a parent. Set this to _.merge or some other function with the same arguments as Object.assign to allow for deep merges. | |
| messages | MessageObject | A hierarchical object containing the messages as boolean, number, string or function values. | |
| onError? | ‘error’ | ‘silent’ | ‘warn’ | ((error: MessageError) => unknown) | <p>(Optional) What to do on errors; most often called if a message is not found.</p><p>- "silent": Ignore the error; use the message’s id as the replacement message.</p><p>- "error": Throw the error.</p><p>- "warn" (default): Print a warning in the console and use the message’s id as the replacement message.</p><p>- (error) => any: A custom function that is called with an Error object with code: string and path: string[] fields set. The return falue is used as the replacement message.</p> | |
| pathSep? | string | null | (Optional) By default, . in a <Message id> splits the path into parts, such that e.g. 'a.b' is equivalent to ['a', 'b']. Use this option to customize or disable this behaviour (by setting it to null). |