Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/molecules/LocalizedLink/LocalizedLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import Link from "next/link"
import { useParams } from "next/navigation"
import { useParams, usePathname } from "next/navigation"
import React, { MouseEventHandler } from "react"

/**
Expand All @@ -20,7 +20,10 @@ const LocalizedClientLink = ({
passHref?: true
[x: string]: any
}) => {
const { locale } = useParams()
const params = useParams()
const pathname = usePathname()

const locale = params?.locale || pathname?.split('/')[1] || 'en'

return (
<Link href={`/${locale}${href}`} {...props}>
Expand Down