"use client" import { useParams } from "next/navigation" import { Lang } from "@/constants/languages" import { languageSchema } from "@/utils/languages" import type { LangParams } from "@/types/params" /** * A hook to get the current lang from the URL */ export default function useLang() { const { lang } = useParams() const parsedLang = languageSchema.safeParse(lang) return parsedLang.success ? parsedLang.data : Lang.en }