UNPKG

react-intlayer

Version:

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

17 lines (15 loc) 605 B
import { getDictionary } from "../getDictionary.mjs"; import { getServerContext } from "./serverContext.mjs"; import { IntlayerServerContext } from "./IntlayerServerProvider.mjs"; //#region src/server/useDictionary.ts /** * On the server side, Hook that transform a dictionary and return the content * * If the locale is not provided, it will use the locale from the server context */ const useDictionary = (dictionary, locale) => { return getDictionary(dictionary, locale ?? getServerContext(IntlayerServerContext)); }; //#endregion export { useDictionary }; //# sourceMappingURL=useDictionary.mjs.map