import { type TOptions } from 'i18next'; /** * Type for children elements in Trans component * Can be either React nodes or an object of values */ type TransChild = React.ReactNode | Record; /** * Shared props for the Trans component used for internationalization. * Either `children` or `defaults` must be provided so that the component * always has fallback text when translations are not loaded. */ interface TransPropsBase { /** * The translation key to look up */ i18nKey: string; /** * React elements to use for interpolation */ components?: readonly React.ReactElement[] | { readonly [tagName: string]: React.ReactElement; }; /** * Count value for pluralization */ count?: number; /** * Namespace for the translation key */ ns?: string; /** * Whether to unescape HTML entities */ shouldUnescape?: boolean; /** * Values to interpolate into the translation */ values?: Record; /** * Class name for the Trans component */ className?: string; /** * Options to pass to the internal t function. Needed for plural forms. * Note: use the separate `context` prop rather than setting context here. */ tOptions?: Omit; } interface TransPropsWithChildren extends TransPropsBase { /** * Child elements or values to interpolate — also serves as fallback text */ children: TransChild | readonly TransChild[]; defaults?: string; } interface TransPropsWithDefaults extends TransPropsBase { children?: TransChild | readonly TransChild[]; /** * Default text if translation is not found */ defaults: string; } type TransProps = TransPropsWithChildren | TransPropsWithDefaults; /** * Function declaration for the Trans component * @param props - The TransProps object containing translation configuration * @returns A React element with translated content */ declare function Trans(props: TransProps): React.ReactElement; /** * Type alias for the Trans component */ type TransType = typeof Trans; /** * Type for the translation function */ type TFunction = (id: string, defaultMessage: string, values?: Record) => string; /** * Type for the resources object */ interface Resources extends Record { } /** * Type for the resource loader function * @param resolvedLanguage - The resolved language to load resources for * @returns A promise that resolves to the resources */ type ResourceLoader = (resolvedLanguage: string) => Promise; export type { ResourceLoader, Resources, TransProps, TransType, TFunction };