"use client";

import { useEffect } from "react";
import { Locale, rtlLocales } from "@allai/i18n/config";

export function LocaleEffect({ locale }: { locale: Locale }) {
  useEffect(() => {
    const direction = rtlLocales.includes(locale) ? "rtl" : "ltr";
    document.documentElement.lang = locale;
    document.documentElement.dir = direction;
  }, [locale]);
  return null;
}
