-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi there!
I'm having a bit of an issue setting up localized URLs. I read the relevant config page, but I can't get to work.
Config
//astro.config.mjs
i18n({
defaultLocale: "fr",
locales: ["fr", "en"],
pages: {
"/portfolio/[slug]": {
fr: "/nos-realisations/[slug]",
en: "/our-work/[slug]"
},
"/about": {
fr: "/a-propos",
en: "/about"
},
"/blog/[slug]": {
fr: "/le-blog/[slug]"
}
},
client: {
data: true,
},
}),Folder structure
src/routes/
------------index.astro
------------about.astro
------------portfolio/
----------------------[slug].astro
----------------------index.astro
------------blog/
----------------------[slug].astro
----------------------index.astro
navigation data
I iterate over an array to create the nav links
const navData: NavItem[] = [
{
key: "home",
url: "/",
},
{
key: "our-work",
url: "/portfolio/",
children: []
},
{
key: "blog",
url: "/blog/",
children: []
},
]
export default navDataExpected output: hitting /portfolio returns a localized url www.example.com/nos-realisations or www.example.com/our-work
What I get: no localization - hitting /portfolio returns www.example.com/portfolio, no matter the locale.
Thank you for your time!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
