react-intlayer
Version:
Easily internationalize i18n your React applications with type-safe multilingual content management.
30 lines (29 loc) • 1.3 kB
TypeScript
import { IInterpreterPluginState as IInterpreterPluginState$1 } from "../plugins.js";
import * as _$_intlayer_core_interpreter0 from "@intlayer/core/interpreter";
import { DeclaredLocales, DictionaryKeys, LocalesValues } from "@intlayer/types/module_augmentation";
import * as _$_intlayer_types0 from "@intlayer/types";
//#region src/client/useIntlayer.d.ts
/**
* Client-side hook that picks one dictionary by its key and returns its content.
*
* If the locale is not provided, it will use the locale from the client context.
*
* @param key - The unique key of the dictionary to retrieve.
* @param locale - Optional locale to override the current context locale.
* @returns The dictionary content for the specified locale.
*
* @example
* ```tsx
* import { useIntlayer } from 'react-intlayer';
*
* const MyComponent = () => {
* const content = useIntlayer('my-dictionary-key');
*
* return <div>{content.myField.value}</div>;
* };
* ```
*/
declare const useIntlayer: <const T extends DictionaryKeys, const L extends LocalesValues = DeclaredLocales>(key: T, locale?: L) => _$_intlayer_core_interpreter0.DeepTransformContent<_$_intlayer_types0.DictionaryRegistryContent<T>, IInterpreterPluginState$1, L>;
//#endregion
export { useIntlayer };
//# sourceMappingURL=useIntlayer.d.ts.map