UNPKG

ra-core

Version:

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

18 lines (14 loc) 585 B
import { createContext } from 'react'; export const TranslatableContext = createContext< TranslatableContextValue | undefined >(undefined); export interface TranslatableContextValue { getLabel: GetTranslatableLabel; getSource: GetTranslatableSource; locales: string[]; selectedLocale: string; selectLocale: SelectTranslatableLocale; } export type GetTranslatableSource = (field: string, locale?: string) => string; export type GetTranslatableLabel = (field: string, label?: string) => string; export type SelectTranslatableLocale = (locale: string) => void;