UNPKG

react-intlayer

Version:

Easily internationalize i18n your React applications with type-safe multilingual content management.

24 lines (21 loc) 635 B
'use client'; import { IntlayerClientContext } from "./IntlayerProvider.mjs"; import { internationalization } from "@intlayer/config/built"; import { useContext } from "react"; //#region src/client/useLocaleBase.ts const { defaultLocale, locales: availableLocales } = internationalization; /** * On the client side, hook to get the current locale and all related fields */ const useLocaleBase = () => { const { locale, setLocale } = useContext(IntlayerClientContext) ?? {}; return { locale, defaultLocale, availableLocales, setLocale }; }; //#endregion export { useLocaleBase }; //# sourceMappingURL=useLocaleBase.mjs.map