revert server-side-translations hack

pull/11587/head
Dmytro Hryshyn 2023-10-26 11:43:48 +03:00
parent f72d7e7bc8
commit dc803a2178
9 changed files with 8 additions and 17 deletions

View File

@ -1,8 +1,8 @@
import NotFoundPage from "@pages/404";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { cookies, headers } from "next/headers";
import { getLocale } from "@calcom/features/auth/lib/getLocale";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
import PageWrapper from "@components/PageWrapperAppDir";

View File

@ -1,5 +1,6 @@
import type { GetServerSidePropsContext } from "next";
import { getCsrfToken } from "next-auth/react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Link from "next/link";
import type { CSSProperties } from "react";
import { useForm } from "react-hook-form";
@ -8,7 +9,6 @@ import { getLocale } from "@calcom/features/auth/lib/getLocale";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import prisma from "@calcom/prisma";
import { Button, PasswordField, Form } from "@calcom/ui";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
import PageWrapper from "@components/PageWrapper";
import AuthContainer from "@components/ui/AuthContainer";

View File

@ -2,6 +2,7 @@
import { debounce } from "lodash";
import type { GetServerSidePropsContext } from "next";
import { getCsrfToken } from "next-auth/react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Link from "next/link";
import type { CSSProperties, SyntheticEvent } from "react";
import React from "react";
@ -10,7 +11,6 @@ import { getLocale } from "@calcom/features/auth/lib/getLocale";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button, EmailField } from "@calcom/ui";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
import PageWrapper from "@components/PageWrapper";
import AuthContainer from "@components/ui/AuthContainer";

View File

@ -1,4 +1,5 @@
import type { GetServerSidePropsContext } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Head from "next/head";
import { usePathname, useRouter } from "next/navigation";
import type { CSSProperties } from "react";
@ -14,7 +15,6 @@ import prisma from "@calcom/prisma";
import { trpc } from "@calcom/trpc";
import { Button, StepCard, Steps } from "@calcom/ui";
import { Loader } from "@calcom/ui/components/icon";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
import PageWrapper from "@components/PageWrapper";
import { ConnectedCalendars } from "@components/getting-started/steps-views/ConnectCalendars";

View File

@ -1,8 +0,0 @@
import { serverSideTranslations as _serverSideTranslations } from "next-i18next/serverSideTranslations";
//@ts-expect-error no type definitions
import config from "@calcom/web/next-i18next.config";
export const serverSideTranslations: typeof _serverSideTranslations = async (locale, namespaces) => {
return _serverSideTranslations(locale, namespaces, config);
};

View File

@ -1,11 +1,11 @@
import type { GetStaticPropsContext } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import superjson from "superjson";
import { CALCOM_VERSION } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
import { createProxySSGHelpers } from "@calcom/trpc/react/ssg";
import { appRouter } from "@calcom/trpc/server/routers/_app";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { i18n } = require("@calcom/config/next-i18next.config");

View File

@ -1,4 +1,5 @@
import type { GetServerSidePropsContext } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import superjson from "superjson";
import { getLocale } from "@calcom/features/auth/lib/getLocale";
@ -6,7 +7,6 @@ import { CALCOM_VERSION } from "@calcom/lib/constants";
import { createProxySSGHelpers } from "@calcom/trpc/react/ssg";
import { createContext } from "@calcom/trpc/server/createContext";
import { appRouter } from "@calcom/trpc/server/routers/_app";
import { serverSideTranslations } from "@calcom/web/server/lib/serverSideTranslations";
/**
* Initialize server-side rendering tRPC helpers.

View File

@ -1,7 +1,6 @@
import i18next from "i18next";
import { i18n as nexti18next } from "next-i18next";
import { serverSideTranslations } from "../../../apps/web/server/lib/serverSideTranslations";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
export const getTranslation = async (locale: string, ns: string) => {
const create = async () => {

View File

@ -6,7 +6,7 @@ type I18nOptions = {
export const i18nHandler = async ({ input }: I18nOptions) => {
const { locale } = input;
const { serverSideTranslations } = await import("@calcom/web/server/lib/serverSideTranslations");
const { serverSideTranslations } = await import("next-i18next/serverSideTranslations");
const i18n = await serverSideTranslations(locale, ["common", "vital"]);
return {