UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

32 lines 904 B
import { TranslatableContextValue } from './TranslatableContext'; /** * Gives access to the current TranslatableContext. * * @example * <TranslatableFields * selector={<MyLanguageSelector />} * locales={['en', 'fr']} * > * <TextField source={getSource('title')} /> * <TranslatableFields> * * const MyLanguageSelector = () => { * const { * locales, * selectedLocale, * selectLocale, * } = useTranslatableContext(); * * return ( * <select onChange={selectLocale}> * {locales.map((locale) => ( * <option selected={locale.locale === selectedLocale}> * {locale.name} * </option> * ))} * </select> * ); * } */ export declare const useTranslatableContext: () => TranslatableContextValue; //# sourceMappingURL=useTranslatableContext.d.ts.map