Files
calendar/packages/trpc/server/routers/publicViewer/i18n.schema.ts
T
Omar LópezandGitHub c4b9a9e2f4 fix: client locale inference (#10893)
* fix: client locale inference

* Update I18nLanguageHandler.tsx

* More fixes

* Update I18nLanguageHandler.tsx

* Update I18nLanguageHandler.tsx

* Addressing feedback

* Fix: first render issues

* Update Credits.tsx

* Fixed tests

* fix: try without loose locale pick

* Revert "fix: try without loose locale pick"

This reverts commit 5ed649c13117fee8bc507098353de0f18e98d971.

* fix: sorts locales so specifics are chosen first

* fix: switches client locale matcher
2023-08-22 20:08:34 +02:00

16 lines
438 B
TypeScript

import { lookup } from "bcp-47-match";
import { z } from "zod";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { i18n } = require("@calcom/config/next-i18next.config");
export const i18nInputSchema = z.object({
locale: z
.string()
.min(2)
.transform((locale) => lookup(i18n.locales, locale) || locale),
CalComVersion: z.string(),
});
export type I18nInputSchema = z.infer<typeof i18nInputSchema>;