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