Link Search Menu Expand Document

Messages.get() method

Get the message or object corresponding to key

Signature:

get(key: string | string[], props?: object, locale?: string): string | any[] | MessageData;

Parameters

Parameter Type Description
key string | string[] The key or keypath being sought
props object Optional properties passed to the function
locale string  

Returns:

string | any[] | MessageData

Remarks

key may be a string for functions at the root level, or string[] for accessing hierarchical objects. If an exact match is not found, the fallback locales are checked for the first match.

If key maps to a message function, the returned value will be the result of calling it with props. If it maps to an object, the object is returned directly. If nothing is found, key is returned.