Fix dynamic default locale routing
This commit is contained in:
@@ -2,7 +2,7 @@ import Link from "next/link";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { getLocalizedPath } from "@/lib/locale";
|
||||
import { AppLocale, getLocalizedPath } from "@/lib/locale";
|
||||
|
||||
const navItems = [
|
||||
{ key: "home", path: "" },
|
||||
@@ -11,7 +11,11 @@ const navItems = [
|
||||
{ key: "contact", path: "/contact" },
|
||||
];
|
||||
|
||||
export function SiteFooter() {
|
||||
type SiteFooterProps = {
|
||||
defaultLocale: AppLocale;
|
||||
};
|
||||
|
||||
export function SiteFooter({ defaultLocale }: SiteFooterProps) {
|
||||
const locale = useLocale();
|
||||
const tNav = useTranslations("navigation");
|
||||
const tFooter = useTranslations("footer");
|
||||
@@ -23,7 +27,7 @@ export function SiteFooter() {
|
||||
{navItems.map((item) => (
|
||||
<Link
|
||||
key={item.key}
|
||||
href={getLocalizedPath(locale, item.path || "/")}
|
||||
href={getLocalizedPath(locale, item.path || "/", defaultLocale)}
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
{tNav(item.key)}
|
||||
|
||||
Reference in New Issue
Block a user