"use client";

import { useEffect } from "react";
import { useLocale } from "@/i18n/navigation";

/**
 * 根据当前 locale 设置 document.documentElement.lang，以支持无障碍与 SEO
 */
export default function SetLangAttr() {
  const locale = useLocale();

  useEffect(() => {
    document.documentElement.lang = locale === "zh" ? "zh-CN" : "en";
  }, [locale]);

  return null;
}
