Localized links should retain the active language segment. Validate supported locales before inserting user-controlled segments into a destination.
Worked example
// app/[lang]/page.tsx
import Link from "next/link";
export default async function LocalePreservingContactLink({
params,
}: {
params: Promise<{ lang: string }>;
}) {
const { lang } = await params;
return (
<Link href={"/" + encodeURIComponent(lang) + "/contact"}>
{lang === "fr" ? "Nous joindre" : "Contact us"}
</Link>
);
}Implementation notes
Locale prefixes can be optional for a default language. Centralize the routing policy rather than concatenating several competing path patterns.
Try it yourself
Follow the contact link from two different locale roots.
Open the Next.js example →Editorial date October 10, 2026 · Published December 6, 2026