getLocalePath
Allows you get the right url for the current locale. It’s strictly typed and even requires you to pass parameters as needed.
1---2// Assuming:3// 1. stragegy is set to "prefixExceptDefault"4// 2. The request page is /fr/my-page5import { getLocalePath } from "i18n:astro"6
7// Routes defined in the integration config8/* /fr */9getLocalePath("/")10/* /fr/a-propos */11getLocalePath("/about")12/* /fr/le-blog/hello-world */13getLocalePath("/blog/[slug]", { slug: "hello-world" })14/* /about */15getLocalePath("/about", null, "en")16
17// Routes not defined in the integration config18/* /fr/abc */19getLocalePath("/abc")20/* /def */21getLocalePath("/def", null, "en")22---