import { useState, type ReactNode } from "react" import { fr } from "./fr" import { en } from "./en" import { I18nContext, LANG_KEY, detectLang, type Dict, type Lang, } from "./context" export function I18nProvider({ children }: { children: ReactNode }) { const [lang, setLangState] = useState(detectLang) const dicts: Record = { fr, en } function setLang(next: Lang) { try { localStorage.setItem(LANG_KEY, next) } catch { // ignore } setLangState(next) } return ( {children} ) }