Open this example in the interactive library
Source code
// 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>
);
}
