import { built_default } from "../@intlayer/config/dist/esm/built.mjs";
import { getServerContext } from "./serverContext.mjs";
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";

//#region ../react-intlayer/dist/esm/server/useLocale.mjs
/**
* 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 useLocale = () => {
	const { defaultLocale, locales: availableLocales } = built_default?.internationalization ?? {};
	return {
		locale: getServerContext(IntlayerServerContext) ?? defaultLocale,
		defaultLocale,
		availableLocales
	};
};

//#endregion
export { useLocale };
//# sourceMappingURL=useLocale.mjs.map