cal.pub0.org/packages/trpc/server/routers/publicViewer/i18n.schema.ts

16 lines
474 B
TypeScript
Raw Normal View History

2023-08-22 12:34:55 +00:00
import parser from "accept-language-parser";
import { z } from "zod";
2023-08-22 12:34:55 +00:00
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { i18n } = require("@calcom/config/next-i18next.config");
export const i18nInputSchema = z.object({
2023-08-22 12:34:55 +00:00
locale: z
.string()
.min(2)
.transform((locale) => parser.pick<string>(i18n.locales, locale, { loose: true }) || locale),
CalComVersion: z.string(),
});
export type I18nInputSchema = z.infer<typeof i18nInputSchema>;