'use client';


import { useLocale } from "react-intlayer";
import { getLocalizedUrl, getPathWithoutLocale } from "@intlayer/core";
import { useCallback, useMemo } from "react";
import { useRouter } from "next/router.js";

//#region src/client/useLocalePageRouter.ts
const useLocalePageRouter = () => {
	const { push, pathname, reload } = useRouter();
	const pathWithoutLocale = useMemo(() => getPathWithoutLocale(pathname), [pathname]);
	return {
		...useLocale({ onLocaleChange: useCallback((locale) => {
			push(getLocalizedUrl(pathWithoutLocale, locale));
			return reload();
		}, [pathWithoutLocale]) }),
		pathWithoutLocale
	};
};

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