Messages.get() method

Get the message or object corresponding to key


get(key: string | string[], props?: Record<string, unknown>, locale?: string): string | unknown[] | MessageData;


Parameter Type Description
key string | string[] The key or keypath being sought
props Record<string, unknown> (Optional) Optional properties passed to the function
locale string (Optional)


string | unknown[] | MessageData


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.