'use client'; import { getDictionarySelectorCacheKey, resolveDictionaryArgument, } from '@intlayer/core/dictionaryManipulator'; import type { DeclaredLocales, DictionaryKeys, DictionarySelectorForKey, LocalesValues, } from '@intlayer/types/module_augmentation'; import { useContext, useMemo } from 'react'; import { getIntlayer } from '../getIntlayer'; import { IntlayerClientContext } from './IntlayerProvider'; /** * Client-side hook that picks one dictionary by its key and returns its content. * * The second argument is either a locale or a selector object: * - `{ item: 2 }` — collection item (omit `item` to get every item as array) * - `{ variant: 'black-friday' }` — named variant (omit for the `default` one) * - `{ variant: ['black-friday', 'promo'] }` — ordered preference chain * - `locale` composes with any selector and overrides the context locale * * `locale` and `variant` both fall back to the surrounding `IntlayerProvider` * when the call does not pin them. * * @param key - The unique key of the dictionary to retrieve. * @param localeOrSelector - Optional locale or selector. * @returns The dictionary content for the resolved entry and locale. * * @example * ```tsx * import { useIntlayer } from 'react-intlayer'; * * const MyComponent = () => { * const content = useIntlayer('my-dictionary-key'); * const faq2 = useIntlayer('faq', { item: 2 }); * * return