Scheduling infrastructure for absolutely everyone.
chore: move getFixedT to web (#13446)
Morganf33ea91ab009
diff --git a/apps/web/app/_utils.tsx b/apps/web/app/_utils.tsxindex da2b3895932..a4bcdf1d10b 100644--- a/apps/web/app/_utils.tsx+++ b/apps/web/app/_utils.tsx@@ -1,12 +1,33 @@import { type TFunction } from "i18next";+import i18next from "i18next";+import { serverSideTranslations } from "next-i18next/serverSideTranslations";import { headers } from "next/headers";import { constructGenericImage } from "@calcom/lib/OgImages";import { IS_CALCOM, WEBAPP_URL, APP_NAME, SEO_IMG_OGIMG } from "@calcom/lib/constants";-import { getFixedT } from "@calcom/lib/server/getFixedT";+//@ts-expect-error no type definitions+import config from "@calcom/web/next-i18next.config";import { preparePageMetadata } from "@lib/metadata";+const create = async (locale: string, ns: string) => {+ const { _nextI18Next } = await serverSideTranslations(locale, [ns], config);++ const _i18n = i18next.createInstance();+ _i18n.init({+ lng: locale,+ resources: _nextI18Next?.initialI18nStore,+ fallbackLng: _nextI18Next?.userConfig?.i18n.defaultLocale,+ });+ return _i18n;+};++const getFixedT = async (locale: string, ns: string) => {+ const i18n = await create(locale, ns);++ return i18n.getFixedT(locale, ns);+};+export const _generateMetadata = async (getTitle: (t: TFunction<string, undefined>) => string,getDescription: (t: TFunction<string, undefined>) => stringdiff --git a/packages/lib/server/getFixedT.ts b/packages/lib/server/getFixedT.tsdeleted file mode 100644index 692c1c8dcc8..00000000000--- a/packages/lib/server/getFixedT.ts+++ /dev/null@@ -1,23 +0,0 @@-import i18next from "i18next";-import { serverSideTranslations } from "next-i18next/serverSideTranslations";--//@ts-expect-error no type definitions-import config from "@calcom/web/next-i18next.config";--export const create = async (locale: string, ns: string) => {- const { _nextI18Next } = await serverSideTranslations(locale, [ns], config);-- const _i18n = i18next.createInstance();- _i18n.init({- lng: locale,- resources: _nextI18Next?.initialI18nStore,- fallbackLng: _nextI18Next?.userConfig?.i18n.defaultLocale,- });- return _i18n;-};--export const getFixedT = async (locale: string, ns: string) => {- const i18n = await create(locale, ns);-- return i18n.getFixedT(locale, ns);-};