9router / src /i18n /RuntimeI18nProvider.js
2api
feat: configurable stream stall timeout + per-provider UI
88c4c60
Raw
History Blame Contribute Delete
629 Bytes
"use client";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { initRuntimeI18n, reloadTranslations } from "./runtime";
export function RuntimeI18nProvider({ children }) {
const pathname = usePathname();
useEffect(() => {
initRuntimeI18n();
}, []);
// Re-process DOM when route changes
useEffect(() => {
if (pathname) {
// Double RAF to ensure React has committed changes to DOM
requestAnimationFrame(() => {
requestAnimationFrame(() => {
reloadTranslations();
});
});
}
}, [pathname]);
return <>{children}</>;
}