react-intlayer
Version:
Easily internationalize i18n your React applications with type-safe multilingual content management.
17 lines (15 loc) • 588 B
JavaScript
import { getIntlayer } from "../getIntlayer.mjs";
import { getServerContext } from "./serverContext.mjs";
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
//#region src/server/useIntlayer.ts
/**
* On the server side, Hook that picking one dictionary by its key and return the content
*
* If the locale is not provided, it will use the locale from the server context
*/
const useIntlayer = (key, locale) => {
return getIntlayer(key, locale ?? getServerContext(IntlayerServerContext));
};
//#endregion
export { useIntlayer };
//# sourceMappingURL=useIntlayer.mjs.map