refactor: update locale navigation hooks and imports
- Rename `usePathname` and `useRouter` to `useLocalePathname` and `useLocaleRouter` - Update imports in locale selector component to use new navigation hook names - Improve type safety and consistency in internationalization routing
This commit is contained in:
parent
d6a230a2dc
commit
8199a07674
@ -7,7 +7,7 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { usePathname, useRouter } from "@/i18n/navigation";
|
||||
import { useLocalePathname, useLocaleRouter } from "@/i18n/navigation";
|
||||
import {
|
||||
DEFAULT_LOCALE,
|
||||
Locale,
|
||||
@ -30,8 +30,8 @@ import { useEffect, useTransition } from "react";
|
||||
* https://next-intl.dev/docs/routing/navigation#userouter
|
||||
*/
|
||||
export default function LocaleSelector() {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const router = useLocaleRouter();
|
||||
const pathname = useLocalePathname();
|
||||
const params = useParams();
|
||||
const locale = useLocale();
|
||||
const { currentLocale, setCurrentLocale } = useLocaleStore();
|
||||
|
@ -6,5 +6,10 @@ import { routing } from "./routing";
|
||||
*
|
||||
* https://next-intl.dev/docs/routing/navigation
|
||||
*/
|
||||
export const { Link: LocaleLink, getPathname: getLocalePathname, redirect, usePathname, useRouter } =
|
||||
createNavigation(routing);
|
||||
export const {
|
||||
Link: LocaleLink,
|
||||
getPathname: getLocalePathname,
|
||||
redirect: localeRedirect,
|
||||
usePathname: useLocalePathname,
|
||||
useRouter: useLocaleRouter
|
||||
} = createNavigation(routing);
|
||||
|
Loading…
Reference in New Issue
Block a user