'use client'; import { Locale } from 'i18n-config'; import { ReactNode, createContext, useContext, useState } from 'react'; interface IContextProps { currentLanguage?: Locale; setCurrentLanguage: (language: Locale) => void; currentDictionary?: any; } export const LanguageContext = createContext({} as IContextProps); export function LanguageProvider({ language, dictionary, children }: { language: Locale; dictionary?: any; children: ReactNode | ReactNode[] | string; }) { const [currentLanguage, setCurrentLanguage] = useState(language || 'en'); const [currentDictionary] = useState(dictionary); return ( {children} ); } export const useLanguage = () => { return useContext(LanguageContext); };