Link Search Menu Expand Document

MessageProviderProps interface


export interface MessageProviderProps 


Property Type Description
children any  
context MessageContext  
debug ‘error’ | ‘warn’ | ((msg: string) => any)  
locale string 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’] 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) => any) What to do on errors; most often called if a message is not found.- "silent": Ignore the error; use the message’s id as the replacement message.- "error": Throw the error.- "warn" (default): Print a warning in the console and use the message’s id as the replacement message.- (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.
pathSep string 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).