import type { Context } from "@wrnexus/core"; import { createLocaleFormatter, formatMessage, plural } from "@wrnexus/i18n"; export const GET = async (ctx: Context) => { const locale = ctx.lang || "en"; const format = createLocaleFormatter(locale, "Asia/Kolkata"); const count = 3; return Response.json({ locale, direction: ["ar", "fa", "he", "ur"].includes(locale.split("-")[0]!) ? "rtl" : "ltr", translated: ctx.t("api.greeting", { name: "Asha" }), interpolated: formatMessage(ctx.t("api.inbox"), { name: "Asha", count }, locale), plural: plural(count, { one: ctx.t("api.itemOne"), other: ctx.t("api.itemOther") }, locale), number: format.number(1_234_567.89), currency: format.currency(1_234.5, "INR"), percent: format.number(0.78, { style: "percent" }), date: format.date("2026-08-15T09:30:00+05:30", { dateStyle: "full" }), relativeTime: format.relative(-3, "day", { numeric: "auto" }), list: format.list(["Mumbai", "Pune", "Nagpur"], { style: "long", type: "conjunction" }), }); };