2
0

first commit

This commit is contained in:
2024-08-09 00:39:27 +02:00
commit 79688abe2e
5698 changed files with 497838 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { useTranslation } from "next-i18next";
import { useAtomsContext } from "@calcom/atoms/monorepo";
export const useLocale = (namespace: Parameters<typeof useTranslation>[0] = "common") => {
const context = useAtomsContext();
const { i18n, t } = useTranslation(namespace);
const isLocaleReady = Object.keys(i18n).length > 0;
if (context?.clientId) {
return { i18n: context.i18n, t: context.t, isLocaleReady: true } as unknown as {
i18n: ReturnType<typeof useTranslation>["i18n"];
t: ReturnType<typeof useTranslation>["t"];
isLocaleReady: boolean;
};
}
return {
i18n,
t,
isLocaleReady,
};
};