UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

16 lines (15 loc) 629 B
import * as React from 'react'; import { useLocalizationInit } from './useLocalizationInit'; const Context = React.createContext(undefined); const LocalizationProvider = ({ children, locale }) => { const value = useLocalizationInit(locale); return (React.createElement(Context.Provider, { value: value }, children)); }; const useLocalizationContext = () => { const context = React.useContext(Context); if (!context) { throw new Error("useLocalizationContext must be used within a LocalizationProvider"); } return context; }; export { LocalizationProvider, useLocalizationContext };