Messages.hasMessage() method
Check if key
is a message function for the locale
Signature:
hasMessage(key: string | string[], locale?: string, fallback?: boolean): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | string[] | The key or keypath being sought |
locale | string | (Optional) If empty or undefined, defaults to this.locale |
fallback | boolean | (Optional) 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.