react-intlayer
Version:
Easily internationalize i18n your React applications with type-safe multilingual content management.
79 lines (78 loc) • 2.23 kB
TypeScript
import { LocalesValues } from "@intlayer/types/module_augmentation";
import * as _$react from "react";
import { FC, PropsWithChildren } from "react";
//#region src/client/IntlayerProvider.d.ts
type IntlayerValue = {
locale: LocalesValues;
setLocale: (newLocale: LocalesValues) => void;
disableEditor?: boolean;
isCookieEnabled?: boolean;
};
/**
* Context that stores the current locale on the client side.
*/
declare const IntlayerClientContext: _$react.Context<IntlayerValue>;
/**
* Hook that provides the current Intlayer client context.
*
* @returns The current Intlayer context values.
*/
declare const useIntlayerContext: () => {};
/**
* Props for the IntlayerProvider component.
*/
type IntlayerProviderProps = PropsWithChildren<{
/**
* The locale to use. If not provided, it will be detected from storage or configuration.
*/
locale?: LocalesValues;
/**
* The default locale to use as a fallback.
*/
defaultLocale?: LocalesValues;
/**
* Function to set the locale.
*/
setLocale?: (locale: LocalesValues) => void;
/**
* Whether to disable the editor.
*/
disableEditor?: boolean;
/**
* Whether to enable cookies for storing the locale.
*/
isCookieEnabled?: boolean;
}>;
/**
* Provider that stores the current locale on the client side.
*
* This component is focused on content delivery without the editor features.
*
* @param props - The provider props.
* @returns The provider component.
*/
declare const IntlayerProviderContent: FC<IntlayerProviderProps>;
/**
* Main provider for Intlayer in React applications.
*
* It includes the editor provider by default, allowing for live content editing
* if configured.
*
* @param props - The provider props.
* @returns The provider component with editor support.
*
* @example
* ```tsx
* import { IntlayerProvider } from 'react-intlayer';
*
* const App = () => (
* <IntlayerProvider>
* <MyComponent />
* </IntlayerProvider>
* );
* ```
*/
declare const IntlayerProvider: FC<IntlayerProviderProps>;
//#endregion
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, IntlayerProviderProps, useIntlayerContext };
//# sourceMappingURL=IntlayerProvider.d.ts.map