cal.pub0.org/packages/lib/hooks/useLocale.ts

13 lines
298 B
TypeScript
Raw Normal View History

import { useTranslation } from "next-i18next";
export const useLocale = (namespace: Parameters<typeof useTranslation>[0] = "common") => {
const { i18n, t } = useTranslation(namespace);
2022-06-16 02:07:07 +00:00
const isLocaleReady = Object.keys(i18n).length > 0;
return {
i18n,
t,
2022-06-16 02:07:07 +00:00
isLocaleReady,
};
};