Link Search Menu Expand Document

Messages.hasObject() method

Check if key is a message object for the locale

Signature:

hasObject(key: string | string[], locale?: string, fallback?: boolean): boolean;

Parameters

Parameter Type Description
key string | string[] The key or keypath being sought
locale string If empty or undefined, defaults to this.locale
fallback boolean If true, also checks fallback locales

Returns:

boolean

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 and fallback is true, the fallback locales are checked for the first match.