web-humas-fe/i18n/request.ts

16 lines
511 B
TypeScript

"use client";
import { notFound } from "next/navigation";
import { getRequestConfig } from "next-intl/server";
import storedLanguage from "@/store/language-store";
export default getRequestConfig(async () => {
const supportedLocale = ["en", "id"];
const locale = storedLanguage((state) => state.locale);
// Validate that the incoming `locale` parameter is valid
if (!supportedLocale.includes(locale)) notFound();
return {
messages: (await import(`../messages/${locale}.json`)).default,
};
});