react-intlayer
Version:
Easily internationalize i18n your React applications with type-safe multilingual content management.
29 lines (27 loc) • 1 kB
JavaScript
import { createServerContext, getServerContext } from "./serverContext.mjs";
import { jsx } from "react/jsx-runtime";
import configuration from "@intlayer/config/built";
//#region src/server/IntlayerServerProvider.tsx
const { defaultLocale } = configuration?.internationalization ?? {};
/**
* Context that store the current locale on the server side
*/
const IntlayerServerContext = createServerContext(defaultLocale);
/**
* Hook that provides the current locale
*/
const useIntlayer = () => getServerContext(IntlayerServerContext);
/**
* Get the current locale
*/
const locale = getServerContext(IntlayerServerContext);
/**
* Provider that store the current locale on the server side
*/
const IntlayerServerProvider = ({ children, locale: locale$1 = defaultLocale }) => /* @__PURE__ */ jsx(IntlayerServerContext.Provider, {
value: locale$1,
children
});
//#endregion
export { IntlayerServerContext, IntlayerServerProvider, locale, useIntlayer };
//# sourceMappingURL=IntlayerServerProvider.mjs.map