2023-05-09 19:27:05 +00:00
|
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
|
|
|
|
import type { WithLocale } from "../../createContext";
|
2023-04-25 22:39:47 +00:00
|
|
|
|
|
|
|
type I18nOptions = {
|
2023-05-09 19:27:05 +00:00
|
|
|
ctx: WithLocale & {
|
|
|
|
req: NextApiRequest | undefined;
|
|
|
|
res: NextApiResponse | undefined;
|
|
|
|
};
|
2023-04-25 22:39:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const i18nHandler = async ({ ctx }: I18nOptions) => {
|
2023-05-09 19:27:05 +00:00
|
|
|
const { locale, i18n } = ctx;
|
2023-04-25 22:39:47 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
i18n,
|
|
|
|
locale,
|
|
|
|
};
|
|
|
|
};
|