translationExists
Checks whether a translation key exists through the registered i18n instance. When subKeys are provided, every nested key must exist for the function to return true.
Importing
ts
import { translationExists } from '@almighty-shogun/vue-utils'Usage
ts
import { translationExists } from '@almighty-shogun/vue-utils'
const hasMenuTranslations = translationExists('navigation', ['dashboard', 'settings']);Parameters
| Name | Type | Description |
|---|---|---|
key | string | Base translation key. |
subKeys | string[] | Optional subkeys that must all exist under the base key. |
Returns
true when the registered i18n instance reports that the key exists. When subKeys are provided, all nested keys must exist.
Type signature
ts
declare function translationExists(
key: string,
subKeys?: string[]
): boolean;