Link Search Menu Expand Document

getMessageGetter() function

Given a MessageContext instance, returns a message getter function, which may have a preset root id path, locale, and/or base parameters for message functions.

The returned function takes two parameters (msgId, msgParams), which will extend any values set by the hook’s arguments.

Signature:

export declare function getMessageGetter(context: MessageContext, rootId?: string | string[], { baseParams, locale }?: MessageGetterOptions): (id?: string | string[] | undefined, params?: any) => any;

Parameters

Parameter Type Description
context MessageContext The MessageContext instance
rootId string | string[] The key or key path of the message or message object. If empty or [], matches the root of the messages object
{ baseParams, locale } MessageGetterOptions  

Returns:

(id?: string | string[] | undefined, params?: any) => any