/**
 * React hook for translations. Uses app store lang and pure translate helpers.
 */

"use client";

import { useAppStore } from "@/store/app-store";
import {
  translate,
  monthName as monthNameFn,
  weekdayLabels as weekdayLabelsFn,
  type Lang,
} from "./messages";

export function useTranslation() {
  const lang = useAppStore((s) => s.lang) as Lang;
  return {
    t: (key: string, params?: Record<string, string>) =>
      translate(lang, key, params ?? {}),
    lang,
    monthName: (month: number) => monthNameFn(lang, month),
    weekdayLabels: () => weekdayLabelsFn(lang),
  };
}
