Files
formbricks-formbricks/apps/web/tolgee/language.ts
Dhruwang Jariwala 36378e9c23 feat: tolgee (#4692)
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
2025-02-07 05:49:35 +00:00

13 lines
546 B
TypeScript

import { authOptions } from "@/modules/auth/lib/authOptions";
import { getServerSession } from "next-auth";
import { DEFAULT_LOCALE } from "@formbricks/lib/constants";
import { getUserLocale } from "@formbricks/lib/user/service";
import { findMatchingLocale } from "@formbricks/lib/utils/locale";
export async function getLocale() {
const session = await getServerSession(authOptions);
let locale = session ? await getUserLocale(session.user?.id) : await findMatchingLocale();
locale = locale ? locale : DEFAULT_LOCALE;
return locale;
}