UNPKG

@translata/react

Version:

React integration for translata: The Composable Translation Utility

16 lines (15 loc) 783 B
import { Translator } from '@translata/core'; import React from 'react'; /** * Create a translator provider, including hooks to consume the translation context. * * @param defaultLocale Default locale. * @param factory Translator factory. */ export declare function createTranslatorProvider<TranslatorType extends Translator<any>>(defaultLocale: string, factory: (locale: string) => TranslatorType): ((props: { children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; }) => JSX.Element) & { useLocale: () => string; useSetLocale: () => (value: string) => void; useTranslator: () => TranslatorType; };